-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
discrepancy between findById and findOne returns #56
Comments
should be fixed in the next release |
Please check out alpha.22 |
Have verified that 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. |
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 fitlerThe text was updated successfully, but these errors were encountered: