Skip to content

Instantly share code, notes, and snippets.

@scotthernandez
Created October 15, 2010 18:47
Show Gist options
  • Save scotthernandez/628718 to your computer and use it in GitHub Desktop.
Save scotthernandez/628718 to your computer and use it in GitHub Desktop.
> db.groups.findOne()
{
"_id" : 1,
"users" : [
{
"name" : "skot",
"age" : 1
},
{
"name" : "fred",
"age" : 2
}
]
}
> db.groups.findOne({users:{$exists:true}})
{
"_id" : 1,
"users" : [
{
"name" : "skot",
"age" : 1
},
{
"name" : "fred",
"age" : 2
}
]
}
> db.groups.findOne({users:{$exists:false}})
{ "_id" : 2, "v" : [ 1, 2, 3 ] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment