Database

[{"_id":ObjectId("5a934e000102030405000000"),"history_doc":{"data":{"objectId":"5a934e000102030405000000"}}},{"key":2}]

Query

db.collection.aggregate({$match:{$expr:{$eq:["$_id",{"$toObjectId":"$history_doc.data.objectId"}]}}})

Result