Query on non empty object field having multiple keys or to check size of object greater than 1

Hello @Aamod_Pisat, and welcome to the community,
you can use $jsonSchema as an alternative to @Prasad_Saya 's solution;

db.collection.find({$nor:[{
   "$jsonSchema":{
      "properties":{
         "test":{
            "type":"object",
	        "properties":{"a":{}},
	        "additionalProperties": false
         }
      }
   }
}]})
1 Like