Closed bwgjoseph closed 3 years ago
should be fixed in the next release
Please check out alpha.22
Have verified that findOne
returns is consistent with the others but the docs has yet to be updated and is currently still reflecting as returning null
Should it be tracked in here and close after the doc is updated? Or do you have another place that tracks for this particular doc update?
let me check with the team @bwgjoseph
Just saw that the doc is not updated
See https://v2.ottomanjs.com/guides/model.html#querying
User.findOne({ name: 'Jane' });
// will return a document with a User with the name "Jane" or null in case of not finding it
Doesn't match with code
@bwgjoseph correct me if I have mistaken, but this ticket awaits only doc updates at the moment ? if thats true then can you move the issue under doc ticket we have please? and close this ticket. If otherwise please let me know
That's correct.
Hi,
When using
findById
and if the document does not exist, it (by right) throws aDocumentNotFoundError: document not found
(see #55)However, when using
findOne
, the documentation says that (and it does) return asnull
when the document is not found (see findOne)I have yet to test for the other
find*
methods.Is it intentional for it to return differently, or should it be consistent in the response across all the
find*
methods?Update:
findOneAndUpdate
also throwsdocument not found
error when unable to match the fitler