Skip to content

DOCSP-30756: add list search indexes to cursor page #704

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

Conversation

nickldp
Copy link
Contributor

@nickldp nickldp commented Jun 28, 2023

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-30756
Staging -
Cursor page
Indexes

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?

@davidhou17
Copy link

Hey @nickldp, I originally reported this ticket, and the change is actually much smaller than what you have drafted, so apologies if this wasn't defined clearly! We only need to add the Collection.listSearchIndexes() function to the following list on the cursor page:
Screenshot 2023-06-28 at 11 19 33 AM

The function itself isn't a cursor paradigm, just a function that returns a cursor. Cursor paradigms allow you to retrieve data from the cursor. Let me know if you have any questions!

Copy link
Collaborator

@rustagir rustagir left a comment

Choose a reason for hiding this comment

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

good start! I suggested moving content and requested some other changes. let me know if you want to talk about any comments.

Return Search Indexes of Collection
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When using a v7.0 and later {+mdb-server+} cluster, you can use the new `listSearchIndex()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
When using a v7.0 and later {+mdb-server+} cluster, you can use the new `listSearchIndex()
When connecting to {+mdb-server+} version 7.0 or later, you can use the new `listSearchIndex()

@@ -114,6 +114,24 @@ through results rather than returning all documents at once.
:start-after: start fetchAll cursor example
:end-before: end fetchAll cursor example

Return Search Indexes of Collection
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Return Search Indexes of Collection
List Search Indexes

@@ -114,6 +114,24 @@ through results rather than returning all documents at once.
:start-after: start fetchAll cursor example
:end-before: end fetchAll cursor example

Return Search Indexes of Collection
Copy link
Collaborator

Choose a reason for hiding this comment

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

I: I'm not sure that this content belongs on this page. This page is about different ways to access data from a cursor, not about methods that return cursors. I think that you could add a section instead to the Indexes fundamentals page that covers this new method and the existing listIndexes() method.

S: Move this section to Indexes and add information also about using listIndexes(). On this page, the only change that should be made is adding this method the list at the top of the page under "The following functions directly return cursors:"

Comment on lines 120 to 123
When using a v7.0 and later {+mdb-server+} cluster, you can use the new `listSearchIndex()
<https://mongodb.github.io/node-mongodb-native/Next/classes/Collection.html#listSearchIndexes>`__
to return a cursor with all the search indexes for the current
collection. ``listSearchIndex()`` has an optional string parameter, ``name``, to
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
When using a v7.0 and later {+mdb-server+} cluster, you can use the new `listSearchIndex()
<https://mongodb.github.io/node-mongodb-native/Next/classes/Collection.html#listSearchIndexes>`__
to return a cursor with all the search indexes for the current
collection. ``listSearchIndex()`` has an optional string parameter, ``name``, to
When using a v7.0 and later {+mdb-server+} cluster, you can use the `listSearchIndex()
<https://mongodb.github.io/node-mongodb-native/Next/classes/Collection.html#listSearchIndexes>`__ method
to return a cursor that contains the search indexes for a
collection. ``listSearchIndex()`` has an optional string parameter, ``name``, to

Comment on lines 120 to 123
When using a v7.0 and later {+mdb-server+} cluster, you can use the new `listSearchIndex()
<https://mongodb.github.io/node-mongodb-native/Next/classes/Collection.html#listSearchIndexes>`__
to return a cursor with all the search indexes for the current
collection. ``listSearchIndex()`` has an optional string parameter, ``name``, to
Copy link
Collaborator

Choose a reason for hiding this comment

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

S: Don't start sentences with monospace text if possible. Introduce methods as The ... method or types as the ... type

Return Search Indexes of Collection
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When using a v7.0 and later {+mdb-server+} cluster, you can use the new `listSearchIndex()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
When using a v7.0 and later {+mdb-server+} cluster, you can use the new `listSearchIndex()
When using a v7.0 and later {+mdb-server+} cluster, you can use the new `listSearchIndexes()

<https://mongodb.github.io/node-mongodb-native/Next/classes/Collection.html#listSearchIndexes>`__
to return a cursor with all the search indexes for the current
collection. ``listSearchIndex()`` has an optional string parameter, ``name``, to
return only the indexes with matching index names. It also has an
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return only the indexes with matching index names. It also has an
return only the indexes with matching index names. It also takes an

Comment on lines 125 to 127
optional ``aggregateOptions`` parameter. For more information, visit the
`API Documentation
<https://mongodb.github.io/node-mongodb-native/Next/interfaces/AggregateOptions.html>`__.
Copy link
Collaborator

Choose a reason for hiding this comment

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

S link the API documentation for aggregateOptions from that word and omit this sentence

@@ -60,6 +60,16 @@ async function rewind(myColl) {
// end rewind cursor example
}

async function listIndexSearch(myColl){
// start listIndexSearch example
const cursor = myColl.listIndexSearch();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I: Isn't this the wrong method name?

Suggested change
const cursor = myColl.listIndexSearch();
const cursor = myColl.listSearchIndexes();

@@ -60,6 +60,16 @@ async function rewind(myColl) {
// end rewind cursor example
}

async function listIndexSearch(myColl){
Copy link
Collaborator

Choose a reason for hiding this comment

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

See example code here

Also, if you move the content from the Cursor page to the indexes page, you will have to move this code to a different file as well.

@nickldp nickldp requested a review from rustagir June 28, 2023 18:43
Copy link
Collaborator

@rustagir rustagir left a comment

Choose a reason for hiding this comment

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

a few more things -- good work responding to comments!

Comment on lines 319 to 320
The ``listIndexes()`` method allows you to list all the indexes'
information in the collection. The ``listIndexes()`` method takes an
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The ``listIndexes()`` method allows you to list all the indexes'
information in the collection. The ``listIndexes()`` method takes an
You can use the ``listIndexes()`` method to list all of the indexes
for a collection. The ``listIndexes()`` method takes an

Comment on lines 321 to 322
optional parameter, `ListIndexesOptions
<{+api+}/interfaces/ListIndexesOptions.html>`__, to set optional
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
optional parameter, `ListIndexesOptions
<{+api+}/interfaces/ListIndexesOptions.html>`__, to set optional
optional `ListIndexesOptions <{+api+}/interfaces/ListIndexesOptions.html>`__ parameter to set optional

Comment on lines 321 to 322
optional parameter, `ListIndexesOptions
<{+api+}/interfaces/ListIndexesOptions.html>`__, to set optional
Copy link
Collaborator

Choose a reason for hiding this comment

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

S; remove this clause of the sentence

Comment on lines 327 to 328
The following example uses the ``listIndexes()`` method to list all the
indexes' information in the collection.
Copy link
Collaborator

Choose a reason for hiding this comment

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

S: change wording to match above suggestion from the first sentence

@@ -312,3 +312,42 @@ the following:
E11000 duplicate key error index

To learn more, see :manual:`Unique Indexes </core/index-unique>`.

List Indexes
~~~~~~~~~~~~
Copy link
Collaborator

Choose a reason for hiding this comment

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

S: make this a header one level up, as the section is not an index type

Comment on lines 340 to 341
method to return a cursor that contains the search indexes for the current
collection. The ``listSearchIndexes()`` method takes an optional string parameter, ``name``, to
Copy link
Collaborator

Choose a reason for hiding this comment

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

Q: What does current mean in this context? Can't you just call the method on whatever collection you want?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, thank you!

@nickldp nickldp requested a review from rustagir June 28, 2023 19:40
@nickldp
Copy link
Contributor Author

nickldp commented Jun 28, 2023

Hey @nickldp, I originally reported this ticket, and the change is actually much smaller than what you have drafted, so apologies if this wasn't defined clearly! We only need to add the Collection.listSearchIndexes() function to the following list on the cursor page: Screenshot 2023-06-28 at 11 19 33 AM

The function itself isn't a cursor paradigm, just a function that returns a cursor. Cursor paradigms allow you to retrieve data from the cursor. Let me know if you have any questions!

Hi @davidhou17! Thanks for letting me know and for the helpful information! Thankfully we found a new home for what I had drafted so it wasn't a waste. Thanks for reaching out! Also, wanted to let you know you have some very clean PRs and I have definitely been trying to take some of that style :)

Copy link
Collaborator

@rustagir rustagir left a comment

Choose a reason for hiding this comment

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

approving but please resolve the last few things

const result = await collection.listIndexes().toArray();
console.log("The indexes in the collection are: ");
for(const doc in result){
console.log(doc);
Copy link
Collaborator

Choose a reason for hiding this comment

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

S: this line should be indented. Maybe re-run the formatter on your code? Also applies to other snippet

List Indexes
------------

You can use the ``listIndexes()`` method to list all of the indexes
Copy link
Collaborator

Choose a reason for hiding this comment

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

S: link to API docs for listIndexes() somewhere. same for below

~~~~~~~~~~~~~~~~~~~

When connecting to {+mdb-server+} version 7.0 or later, you can use the new `listSearchIndexes()
<https://mongodb.github.io/node-mongodb-native/Next/classes/Collection.html#listSearchIndexes>`__
Copy link
Collaborator

Choose a reason for hiding this comment

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

Investigating why the 5.6 docs don't cover this method

Comment on lines 326 to 327
The following example uses the ``listIndexes()`` method to list all the
indexes in a collection.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The following example uses the ``listIndexes()`` method to list all the
indexes in a collection.
The following code uses the ``listIndexes()`` method to list all the
indexes in a collection:

Comment on lines 347 to 348
The following example uses the ``listSearchIndexes()`` method to list all
the search indexes in the collection.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The following example uses the ``listSearchIndexes()`` method to list all
the search indexes in the collection.
The following code uses the ``listSearchIndexes()`` method to list all
the search indexes in the collection:

the search indexes in the collection.

.. literalinclude:: /code-snippets/indexes/listSearchIndexes.js
:language: javascript
Copy link
Collaborator

Choose a reason for hiding this comment

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

add :dedent:

try {
// start listIndexes example
const result = await collection.listIndexes().toArray();
console.log("The indexes in the collection are: ");
Copy link
Collaborator

Choose a reason for hiding this comment

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

S: Per the style guide, we do not introduce lists with fragment sentences. (also applies to other file)

Perhaps something like this would be better:

Suggested change
console.log("The indexes in the collection are: ");
console.log("Existing indexes:\n");

@nickldp nickldp merged commit 966fe9f into mongodb:master Jun 28, 2023
nickldp added a commit that referenced this pull request Jun 29, 2023
* first draft

* first draft

* first draft

* first draft

* first draft

* first draft v1.1

* big fixes

* big fixes

* review fixes

(cherry picked from commit 966fe9f)
mongoKart pushed a commit to mongoKart/docs-node that referenced this pull request Nov 3, 2023
* first draft

* first draft

* first draft

* first draft

* first draft

* first draft v1.1

* big fixes

* big fixes

* review fixes
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.

3 participants