Skip to content
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

Closed
bwgjoseph opened this issue Apr 3, 2021 · 7 comments
Closed

discrepancy between findById and findOne returns #56

bwgjoseph opened this issue Apr 3, 2021 · 7 comments
Assignees
Labels
await-verification wait for new release to verify

Comments

@bwgjoseph
Copy link
Owner

bwgjoseph commented Apr 3, 2021

Hi,

When using findById and if the document does not exist, it (by right) throws a DocumentNotFoundError: document not found (see #55)

However, when using findOne, the documentation says that (and it does) return as null 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 throws document not found error when unable to match the fitler

@AV25242 AV25242 added follow-up Issue to follow-up internally issue-created an issue has been created for the team to work and removed follow-up Issue to follow-up internally labels Apr 3, 2021
@AV25242
Copy link
Collaborator

AV25242 commented Apr 5, 2021

should be fixed in the next release

@AV25242 AV25242 assigned bwgjoseph and unassigned AV25242 Apr 16, 2021
@AV25242
Copy link
Collaborator

AV25242 commented Apr 16, 2021

Please check out alpha.22

@AV25242 AV25242 added await-verification wait for new release to verify and removed issue-created an issue has been created for the team to work labels Apr 16, 2021
bwgjoseph added a commit that referenced this issue Apr 16, 2021
@bwgjoseph
Copy link
Owner Author

bwgjoseph commented Apr 16, 2021

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?

@AV25242
Copy link
Collaborator

AV25242 commented Apr 16, 2021

let me check with the team @bwgjoseph

@AV25242 AV25242 added documentation Improvements or additions to documentation follow-up Issue to follow-up internally and removed await-verification wait for new release to verify labels Apr 20, 2021
@httpJunkie httpJunkie assigned bwgjoseph and unassigned AV25242 May 7, 2021
@httpJunkie httpJunkie added await-verification wait for new release to verify and removed documentation Improvements or additions to documentation follow-up Issue to follow-up internally labels May 7, 2021
@bwgjoseph
Copy link
Owner Author

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

image

@bwgjoseph bwgjoseph reopened this May 7, 2021
@bwgjoseph bwgjoseph assigned AV25242 and unassigned bwgjoseph May 7, 2021
@AV25242 AV25242 added follow-up Issue to follow-up internally and removed await-verification wait for new release to verify labels May 19, 2021
@AV25242
Copy link
Collaborator

AV25242 commented May 20, 2021

@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

@AV25242 AV25242 added await-verification wait for new release to verify and removed follow-up Issue to follow-up internally labels May 20, 2021
@AV25242 AV25242 assigned bwgjoseph and unassigned AV25242 May 20, 2021
@bwgjoseph
Copy link
Owner Author

That's correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
await-verification wait for new release to verify
Projects
None yet
Development

No branches or pull requests

3 participants