Skip to content

Commit d23aeaf

Browse files
committed
should correctly pass indexOptionDefault through to createIndexCommand
Signed-off-by: Christian Kvalheim <[email protected]>
1 parent 85d0cd7 commit d23aeaf

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

test/functional/index_tests.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,3 +747,44 @@ exports.shouldCorrectlyCreateTextIndex = {
747747
});
748748
}
749749
}
750+
751+
/**
752+
* @ignore
753+
*/
754+
exports['should correctly pass indexOptionDefault through to createIndexCommand'] = {
755+
metadata: { requires: { topology: ['single', 'replicaset', 'sharded', 'ssl', 'heap', 'wiredtiger'], mongodb: ">=3.1.8" } },
756+
757+
// The actual test we wish to run
758+
test: function(configuration, test) {
759+
var db = configuration.newDbInstance(configuration.writeConcernMax(), {poolSize:1});
760+
db.open(function(err, db) {
761+
var listener = require('../..').instrument(function(err, instrumentations) {
762+
callbackTriggered = true;
763+
});
764+
765+
listener.on('started', function(event) {
766+
if(event.commandName == 'insert')
767+
started.push(event);
768+
});
769+
770+
listener.on('succeeded', function(event) {
771+
if(event.commandName == 'insert')
772+
succeeded.push(event);
773+
});
774+
775+
776+
db.collection('indexOptionDefault').createIndex({a:1}, { indexOptionDefaults: true }, function(err, r) {
777+
console.log("-------------------------------------------------------------")
778+
console.dir(err)
779+
console.dir(r)
780+
console.dir(started)
781+
782+
test.equal(null, err);
783+
listener.uninstrument();
784+
785+
db.close();
786+
test.done();
787+
});
788+
});
789+
}
790+
}

0 commit comments

Comments
 (0)