rename.md 571 字节
Newer Older
A
Avi Aryan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
# rename function

`rename()` will update the replace existing key names with new ones based on the provided configuration. It currently only works for top level fields (i.e. `address.street` would not work).

### configuration

```javascript
rename({"field_map": {"test":"renamed"}})
```

### example

message in
```JSON
{
    "_id": 0,
    "name": "abc",
    "type": "function",
    "count": 10
}
```

config
```javascript
rename({"field_map": {"count":"total"}})
```

message out
```JSON
{
    "_id": 0,
    "name": "abc",
    "type": "function",
    "total": 10
}
```