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

Hello @Aamod_Pisat, welcome to the MongoDB Community forum!

You can use the $exists query operator to check if a field exists or not - within a document. For example, the query

db.col.find( { ''test.a': { $exists: true } )

returns both the documents from your example collection.

db.col.find( { ''test.b': { $exists: true } )

returns only one document, the one with "_id": ObjectID('123').