Database

db={users:[{_id:1,a:"",b:1,"createdAccounts":{"test@gmail.com":{"id":["a","b","c"]}}}]}

Query

db.users.aggregate([{"$project":{"createdAccounts":{"$objectToArray":"$createdAccounts"}}},{"$match":{/** replace with the `email` you want to match*/"createdAccounts.k":"test@gmail.com"}},{"$set":{"createdAccounts.v.id":{"$concatArrays":[/** unclear why I need this "first" but the* concat produces an extra array if I don't*/{"$first":"$createdAccounts.v.id"},["X"]/** <-- put the element you want to add*/]}}},{"$set":{"createdAccounts":{"$arrayToObject":"$createdAccounts"}}},{"$merge":{"into":"collection","on":"_id","whenMatched":"merge","whenNotMatched":"discard"}}])

Result