Hello @Lord_Wasabi, here are couple of ways to get the list of id values as an array from your collection based upon the condition:
var idObjArr = db.collection.find( { $expr: { $gt: [ "$propB", "$propA" ] } }, { _id: 0, id: 1 } ).toArray()
var idArr = []
idObjArr.forEach(doc => idArr.push(doc.id))
Or, you can use this approach; this one only retruns distinct (unique) id values.
var idArr = db.collection.distinct("id", { $expr: { $gt: [ "$propB", "$propA" ] } } )