Database

[{"id":"A"},{"id":"B","parentId":"A"}]

Query

db.collection.update({},[{"$set":{"parentId":{"$ifNull":["$parentId",null]}}}])

Result