Database
[{object_1:{property_1:"1",property_2:"2"},object_2:{property_1:"1",property_2:"2"}}]
Query
db.collection.aggregate([{"$match":{"$expr":{"$cond":{if:{"$and":[{"$eq":[{"$type":"$object_1"},"object"]},{"$eq":[{"$type":"$object_2"},"object"]}]},then:{"$setEquals":[{"$objectToArray":"$object_1"},{"$objectToArray":"$object_2"}]},else:{"$eq":["$object_1","$object_2"]}}}}}])