|
Clients can use a write concern when inserting into the system.indexes collection on mongos using OP_INSERT and getlasterror, but mongos doesn't accept a writeConcern field for inserts into system.indexes with the insert command:
mongos> db.serverBuildInfo().version
|
2.5.5-pre-
|
mongos> db.serverBuildInfo().gitVersion
|
ed76da14b416376045dfe84cf3ad5866bd4feb1f
|
mongos> db.system.indexes.insert({key: {k: 1}, ns: 'test.collection', name: 'name'})
|
mongos> db.getLastError(2)
|
null
|
mongos> db.collection.drop()
|
true
|
mongos> db.runCommand({insert: 'system.indexes', documents: [{key: {k: 1}, ns: 'test.collection', name: 'name'}], writeConcern: {w: 2}})
|
{
|
"ok" : 0,
|
"code" : 72,
|
"errmsg" : "invalid batch request for index creation"
|
}
|
Creating an index on mongod with an insert command and writeConcern behaves as expected: the command blocks until the index is built on N replicas.
|