-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.12.1
-
Component/s: Write Operations
-
Labels:None
When updating via Mongo Shell (MongoDB 2.6.0) we get 3 'n' numbers :
bippo:PRIMARY> db.salesOrder.update({formalId: '100000001'}, {'$unset': {formalIdTrie: ''}}); WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 0 })
However only `WriteResult.getN()` is provided by the Java API. From the mongo-java-driver 2.12.1 implementation :
/** * Gets the "n" field, which contains the number of documents * affected in the write operation. * @return the number of documents modified by the write operation * @throws MongoException */ public int getN(){ return getLastError().getInt( "n" ); }
is it correct? Since there seems to be no n field in the WriteResult object when observed via Mongo shell.