summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2014-02-26 11:56:31 -0500
committerRandolph Tan <randolph@10gen.com>2014-02-26 16:05:04 -0500
commitd908a87df9f601cec7be3d34abd00f258679ff44 (patch)
tree136f255ddd96ea78ec058fe794e6fc0ba1bc04c3
parent3709484b65d0c153d4d52713e8466b7b3a791233 (diff)
downloadmongo-d908a87df9f601cec7be3d34abd00f258679ff44.tar.gz
SERVER-12911 make ensureIndex return value consistent
-rw-r--r--src/mongo/shell/collection.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/mongo/shell/collection.js b/src/mongo/shell/collection.js
index f57443ee85e..32ed762a8a8 100644
--- a/src/mongo/shell/collection.js
+++ b/src/mongo/shell/collection.js
@@ -506,10 +506,8 @@ DBCollection.prototype.createIndex = function( keys , options ){
DBCollection.prototype.ensureIndex = function( keys , options ){
var result = this.createIndex(keys, options);
- if (result != null) {
- if (!result.ok) return result;
- // Preserve old behavior of returning undefined on success.
- return;
+ if ( this._mongo.useWriteCommands() ) {
+ return result;
}
err = this.getDB().getLastErrorObj();