I've noticed that there may be an issue with the 'findOne' implementation when searching for objectIds.
If I execute the following code with a known document id as testId (i.e. 4c2b920f7b78cb5b12dea3fc), I receive a null value on return:
var c = testCol.findOne({ _id : objectId(testId) });
I wrote a similar 'findOne' function called 'findSingle' which is based on the 'find' implementation. When I pass it the same parameters as the 'findOne' call, I receive the expected document on return:
findSingle: function() {
var args = Array.prototype.slice.call(arguments)
.map(function(arg) {
return typeof arg == "object" ?
Support.createBDObject(arg) : arg;
});
return this.collection.findOne.apply(this.collection, args);
}
var c = testCol.findSingle({ _id : objectId(testId) });
Is this an issue with the 'findOne' implementation or am I using it incorrectly?
I've noticed that there may be an issue with the 'findOne' implementation when searching for objectIds.
If I execute the following code with a known document id as testId (i.e. 4c2b920f7b78cb5b12dea3fc), I receive a null value on return:
var c = testCol.findOne({ _id : objectId(testId) });I wrote a similar 'findOne' function called 'findSingle' which is based on the 'find' implementation. When I pass it the same parameters as the 'findOne' call, I receive the expected document on return:
findSingle: function() {var args = Array.prototype.slice.call(arguments)
.map(function(arg) {
return typeof arg == "object" ?
Support.createBDObject(arg) : arg;
});
return this.collection.findOne.apply(this.collection, args);
}
var c = testCol.findSingle({ _id : objectId(testId) });Is this an issue with the 'findOne' implementation or am I using it incorrectly?