-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Add next test code to Node.js mongodb driver test suite.
exports['Should correctly find one document with custom fields and undefined callback'] = {
metadata: {
requires: {
promises: true,
topology: ['single']
}
},
test: function (configuration, test) {
var db = configuration.newDbInstance(configuration.writeConcernMax(), {
poolSize: 1,
auto_reconnect: false
});
db.open().then(function (db) {
var collection = db.collection('findOneDocumentCustomFieldsUndefinedCallback');
collection.insertMany([{
a: 1,
b: 1
}, {
a: 2,
b: 2
}, {
a: 3,
b: 3
}, {
a: 4,
b: 4
}], configuration.writeConcernMax()).then(function (result) {
// Show that duplicate records got dropped
collection.findOne({
a: 1
}, {
fields: {
b: 1,
_id: 0
}
}, undefined).then(function (item) {
test.equal(item._id, undefined);
test.equal(item.b, 1);
test.equal(item.a, undefined);
db.close();
test.done();
});
});
});
}
}
I expect findOne works in the same way with two arguments and three arguments with undefined or null as value.