Permalink
Browse files

SERVER-12911 make ensureIndex return value consistent

  • Loading branch information...
1 parent 3709484 commit d908a87df9f601cec7be3d34abd00f258679ff44 @renctan renctan committed Feb 26, 2014
Showing with 2 additions and 4 deletions.
  1. +2 −4 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();

0 comments on commit d908a87

Please sign in to comment.