If I have a mongodb collection users
like this:
{
"_id": 1,
"name": {
"first" : "John",
"last" :"Backus"
},
}
How do I retrieve name.first
from this without providing _id
or any other reference. Also, is it possible that pulling just the `name^ can give me the array of embedded keys (first and last in this case)? How can that be done?
db.users.find({"name.first"})
didn't work for me, I got a:
SyntaxError "missing: after property id (shell):1