"_id" : ObjectId("0fffa133x"),
"properties" : [
{
"key" : "1",
“value” : “a”
},
{
"key” : “1”,
“value” : “b”
},...
]},
{ "_id" : ObjectId("0fffa132x"),
"properties" : [
{
"key" : "1",
“value” : “a”
},
{
"key” : “2”,
“value” : “b”
},...
]},....
]
Im relatively new to mongodb, so I’m having trouble with this one query. Basically, I need a mongodb query that returns all the documents where properties array contains duplicate keys. For example above, the query should return document with id 0fffa133x since key:1 appear twice in the array. Any help is appreciated!