MongoDB setOnInsert
If an update operation with upsert: true results in an insert of a document, then $setOnInsert assigns the specified values to the fields in the document. If the update operation does not result in an insert, $setOnInsert does nothing….
$setOnInsert with a shard key – not possible ?
Having the collection empty, when trying to do an upsert using $setOnInsert on a shard key I get the following error: Can’t modify shard key’s value. field: card: 1.0 collection: vizvid.total_video_views mongos> db.dbversity.status() { “sharded” : true, “ns” : “dbfry.dbversity”,…