I have an array of documents as such:
"players" : [
{
"approved" : true,
"isGM" : true,
"user" : {
"userID" : 1,
"username" : "User 1"
}
}
],
I'm trying to rename userID
to userId
with
db.games.update({}, { $rename: { 'players.user.userID': 'players.user.userId' } });
But when I do, I get cannot use the part (players of players.user.userID) to traverse the element
. How can I rename these fields and why the current method doesn't work?