Skip to content

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

Merged
merged 4 commits into from
May 12, 2023

Conversation

rustagir
Copy link
Collaborator

Pull Request Info

PR Reviewing Guidelines

JIRA - DOCSP-29805
Staging

Self-Review Checklist

  • Is this free of any warnings or errors in the RST?
  • Did you run a spell-check?
  • Did you run a grammar-check?
  • Are all the links working?

Copy link
Contributor

@DBirtolo-mdb DBirtolo-mdb left a 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.

Comment on lines 66 to 68
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.
Copy link
Contributor

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.

Copy link
Collaborator Author

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

Comment on lines 70 to 71
Even if you pass an empty query in a find operation, you can
specify options. For example, the following code shows how you can
Copy link
Contributor

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.

Suggested change
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

@rustagir rustagir requested a review from DBirtolo-mdb May 12, 2023 15:03
Copy link
Contributor

@DBirtolo-mdb DBirtolo-mdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rustagir rustagir merged commit a4883c9 into mongodb:master May 12, 2023
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
rustagir added a commit that referenced this pull request May 12, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
jordan-smith721 pushed a commit to jordan-smith721/docs-node that referenced this pull request Jul 24, 2023
* 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)
(cherry picked from commit 6a8994c)
(cherry picked from commit 723cb73)
mongoKart pushed a commit to mongoKart/docs-node that referenced this pull request Nov 3, 2023
* DOCSP-29805: find op with no/empty query document

* wording fixes

* replace refs while im here

* DB PR fixes 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants