Skip to content

Commit 153d410

Browse files
committed
SERVER-12215 createIndex and ensureIndex do not report error with write commands
Match old behavior for ensureIndex return value
1 parent 8869eab commit 153d410

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/mongo/shell/collection.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ DBCollection.prototype.ensureIndex = function( keys , options ){
460460
var result = this.createIndex(keys, options);
461461

462462
if (result != null) {
463-
if (result.errmsg != null) return result.errmsg;
463+
if (!result.ok) return result;
464+
// Preserve old behavior of returning undefined on success.
464465
return;
465466
}
466467

0 commit comments

Comments
 (0)