How do I query for everyone who has a nickname and replace the nickname key with just "nick"
Dataset looks like this with a lot more fields and a lot more documents. the nickname obj is in an unknown index if it exists.
{
_id: "robert",
properties: [
{
"kids": 3
},
{
"nickname": "Bob"
},
{
"age": 45
}
]
}
{
_id: "alice",
properties: [
{
"kids": 3
},
{
"age": 45
}
]
}
{
_id: "joseph",
properties: [
{
"nickname": "joe"
}
]
}
In the end it should be:
{
_id: "robert",
properties: [
{
"kids": 3
},
{
"nick": "Bob"
},
{
"age": 45
}
]
}
{
_id: "alice",
properties: [
{
"kids": 3
},
{
"age": 45
}
]
}
{
_id: "joseph",
properties: [
{
"nick": "joe"
}
]
}