-
Notifications
You must be signed in to change notification settings - Fork 51
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
DOCSP-30756: add list search indexes to cursor page #704
Conversation
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 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! |
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.
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() |
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.
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 |
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.
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 |
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.
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:"
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 |
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.
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 |
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 |
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.
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() |
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.
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 |
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.
return only the indexes with matching index names. It also has an | |
return only the indexes with matching index names. It also takes an |
optional ``aggregateOptions`` parameter. For more information, visit the | ||
`API Documentation | ||
<https://mongodb.github.io/node-mongodb-native/Next/interfaces/AggregateOptions.html>`__. |
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.
S link the API documentation for aggregateOptions
from that word and omit this sentence
source/code-snippets/crud/cursor.js
Outdated
@@ -60,6 +60,16 @@ async function rewind(myColl) { | |||
// end rewind cursor example | |||
} | |||
|
|||
async function listIndexSearch(myColl){ | |||
// start listIndexSearch example | |||
const cursor = myColl.listIndexSearch(); |
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.
I: Isn't this the wrong method name?
const cursor = myColl.listIndexSearch(); | |
const cursor = myColl.listSearchIndexes(); |
source/code-snippets/crud/cursor.js
Outdated
@@ -60,6 +60,16 @@ async function rewind(myColl) { | |||
// end rewind cursor example | |||
} | |||
|
|||
async function listIndexSearch(myColl){ |
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.
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.
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.
a few more things -- good work responding to comments!
source/fundamentals/indexes.txt
Outdated
The ``listIndexes()`` method allows you to list all the indexes' | ||
information in the collection. The ``listIndexes()`` method takes an |
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.
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 |
source/fundamentals/indexes.txt
Outdated
optional parameter, `ListIndexesOptions | ||
<{+api+}/interfaces/ListIndexesOptions.html>`__, to set optional |
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.
optional parameter, `ListIndexesOptions | |
<{+api+}/interfaces/ListIndexesOptions.html>`__, to set optional | |
optional `ListIndexesOptions <{+api+}/interfaces/ListIndexesOptions.html>`__ parameter to set optional |
source/fundamentals/indexes.txt
Outdated
optional parameter, `ListIndexesOptions | ||
<{+api+}/interfaces/ListIndexesOptions.html>`__, to set optional |
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.
S; remove this clause of the sentence
source/fundamentals/indexes.txt
Outdated
The following example uses the ``listIndexes()`` method to list all the | ||
indexes' information in the 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.
S: change wording to match above suggestion from the first sentence
source/fundamentals/indexes.txt
Outdated
@@ -312,3 +312,42 @@ the following: | |||
E11000 duplicate key error index | |||
|
|||
To learn more, see :manual:`Unique Indexes </core/index-unique>`. | |||
|
|||
List Indexes | |||
~~~~~~~~~~~~ |
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.
S: make this a header one level up, as the section is not an index type
source/fundamentals/indexes.txt
Outdated
method to return a cursor that contains the search indexes for the current | ||
collection. The ``listSearchIndexes()`` method takes an optional string parameter, ``name``, to |
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.
Q: What does current mean in this context? Can't you just call the method on whatever collection you want?
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.
Good point, thank you!
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 :) |
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.
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); |
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.
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 |
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.
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>`__ |
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.
Investigating why the 5.6 docs don't cover this method
source/fundamentals/indexes.txt
Outdated
The following example uses the ``listIndexes()`` method to list all the | ||
indexes in 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.
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: |
source/fundamentals/indexes.txt
Outdated
The following example uses the ``listSearchIndexes()`` method to list all | ||
the search indexes in the 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.
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 |
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.
add :dedent:
try { | ||
// start listIndexes example | ||
const result = await collection.listIndexes().toArray(); | ||
console.log("The indexes in the collection are: "); |
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.
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:
console.log("The indexes in the collection are: "); | |
console.log("Existing indexes:\n"); |
* 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)
* first draft * first draft * first draft * first draft * first draft * first draft v1.1 * big fixes * big fixes * review fixes
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-30756
Staging -
Cursor page
Indexes
Self-Review Checklist