Mongo Playground

Configuration

[{"cityId":NumberInt(1),"stateId":NumberInt(2)},{"cityId":NumberInt(9),"stateId":NumberInt(8)}]

Query

db.collection.update({},[{"$set":{"id":"$_id"}}],{"multi":true})

Result