I currently have a database that is structured as followed...
"_id" : "neRmMTTkRvoKFGL3a",
"active_users" : [
{
"user" : {
"_id" : "CYyxPcAnfhns28stb",
...
},
"last_seen" : 1403814568360
},
{
Other users....
}
],
"room_name": "TestRoom"
I want to be able to update the last_seen attribute. I have been trying to use the following query (or variations of it) but have had no luck so far. Any help would be much appreciated.
db.rooms.update({room_name: "TestRoom",
'active_users.user._id': 'CYyxPcAnfhns28stb'
}, {$set: {'active_users.last_seen.$': Date.now()}})