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').