Ok I got it...
Since you are making the indexes unique - the values cannot ever share the same value. The values are [1,2,3]. The increment is an atomic operation by MongoDB so they occur one at a time... First would be [2,2,3] then [2,3,3] then finally [2,3,4].
To prove this... simply reverse the values to [3,2,1] to begin.
> db.foo5.insert([{_pos:3,b:12},{_pos:2,a:23},{_pos:1,c:12}])
BulkWriteResult({
"writeErrors" : [ ],
"writeConcernErrors" : [ ],
"nInserted" : 3,
"nUpserted" : 0,
"nMatched" : 0,
"nModified" : 0,
"nRemoved" : 0,
"upserted" : [ ]
})
> db.foo5.createIndex( { "_pos" : 1 }, { unique: true } )
{
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 1,
"numIndexesAfter" : 2,
"ok" : 1
}
> db.foo5.find()
{ "_id" : ObjectId("57a9f76cb28f053d25a821a5"), "_pos" : 3, "b" : 12 }
{ "_id" : ObjectId("57a9f76cb28f053d25a821a6"), "_pos" : 2, "a" : 23 }
{ "_id" : ObjectId("57a9f76cb28f053d25a821a7"), "_pos" : 1, "c" : 12 }
> db.foo5.update({}, { "$inc" : {"_pos" : 1} }, { multi : true })
WriteResult({ "nMatched" : 3, "nUpserted" : 0, "nModified" : 3 })
> db.foo5.find()
{ "_id" : ObjectId("57a9f76cb28f053d25a821a5"), "_pos" : 4, "b" : 12 }
{ "_id" : ObjectId("57a9f76cb28f053d25a821a6"), "_pos" : 3, "a" : 23 }
{ "_id" : ObjectId("57a9f76cb28f053d25a821a7"), "_pos" : 2, "c" : 12 }