Reputation: 3092
My JSON is:
db.col.insert([
{
"1":[
{
"a":"1",
"b":"2",
"v":"12"
}
]
},
{
"2":[
{
"a":"12",
"v":"451"
}
]
}])
when I query using
db.col.find("1")
It is returning both the rows instead of the condition. how can i select just one row here?
Upvotes: 0
Views: 490
Reputation: 26012
You can filter the data by checking if the given field exists using $exists keyword as follows :
db.col.find({1 : {$exists:true}})
Upvotes: 1