Skip to content

Commit de79c13

Browse files
committed
NODE-477 Added test case showing insertOne with w:0 working as expected
1 parent 711c256 commit de79c13

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/functional/crud_api_tests.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,31 @@ exports['should correctly execute removeMany with no selector'] = {
793793
db.collection('t6_1').deleteMany(function(err, r) {
794794
test.equal(null, err);
795795

796+
db.close();
797+
test.done();
798+
});
799+
});
800+
}
801+
}
802+
803+
exports['should correctly execute insertOne with w:0'] = {
804+
// Add a tag that our runner can trigger on
805+
// in this case we are setting that node needs to be higher than 0.10.X to run
806+
metadata: { requires: { topology: ['single', 'replicaset', 'sharded', 'ssl', 'heap', 'wiredtiger'] } },
807+
808+
// The actual test we wish to run
809+
test: function(configuration, test) {
810+
var db = configuration.newDbInstance(configuration.writeConcernMax(), {poolSize:1, auto_reconnect:false});
811+
// Establish connection to db
812+
db.open(function(err, db) {
813+
test.equal(null, err);
814+
815+
var col = db.collection('shouldCorrectlyExecuteInsertOneWithW0');
816+
817+
col.insertOne({a:1}, {w:0}, function(err,result) {
818+
test.equal(null, err);
819+
test.equal(1, result.result.ok);
820+
796821
db.close();
797822
test.done();
798823
});

0 commit comments

Comments
 (0)