I want to search for all documents that have 255255
as their key value. the id
on top is the id of the document.
"id" : "555114",
"255255" : {
"someField" : null,
},
"255256" : {
"someField" : null,
},
I want to search for all documents that have 255255
as their key value. the id
on top is the id of the document.
"id" : "555114",
"255255" : {
"someField" : null,
},
"255256" : {
"someField" : null,
},
2
Answers
You can use
$exist
to check if the key is present in document or not.You can use the exists operator.
From the MongoDB docs: