-
Notifications
You must be signed in to change notification settings - Fork 51
DOCSP-29805: no query criteria in find #681
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Just a couple of questions I wasn't sure about and one suggestion for you to consider.
If you don't pass a query or pass an empty query | ||
to the ``findOne()`` method, the operation returns the first | ||
document of a collection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question]
Is this accurate? I thought it returned a random one, not a guaranteed first one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my testing, it is always the first one, but here's what the Manual says:
Returns one document that satisfies the specified query criteria on the collection or view. If multiple documents satisfy the query, this method returns the first document according to the natural order which reflects the order of documents on the disk.
Maybe it's best to be on the safe side and just say a single document
Even if you pass an empty query in a find operation, you can | ||
specify options. For example, the following code shows how you can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[suggestion]
I'd recommend switching this to put the imperative of what readers can do before the conditional.
Even if you pass an empty query in a find operation, you can | |
specify options. For example, the following code shows how you can | |
You can | |
specify options in a find operation even when you pass an empty query. For example, the following code shows how you can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* DOCSP-29805: find op with no/empty query document * wording fixes * replace refs while im here * DB PR fixes 1 (cherry picked from commit a4883c9)
* DOCSP-29805: find op with no/empty query document * wording fixes * replace refs while im here * DB PR fixes 1 (cherry picked from commit a4883c9)
* DOCSP-29805: find op with no/empty query document * wording fixes * replace refs while im here * DB PR fixes 1 (cherry picked from commit a4883c9)
* DOCSP-29805: find op with no/empty query document * wording fixes * replace refs while im here * DB PR fixes 1
Pull Request Info
PR Reviewing Guidelines
JIRA - DOCSP-29805
Staging
Self-Review Checklist