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
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions source/code-snippets/crud/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.

// 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();

console.log("All the search indexes in the collection: ");
for await (const doc of cursor){
console.log(doc);
}
// end listIndexSearch example
}

async function close(myColl) {
const cursor = myColl.find({});

Expand All @@ -80,6 +90,7 @@ async function run() {
await fetchAll(orders);
await rewind(orders);
await count(orders);
//await listIndexSearch(orders);
} finally {
await client.close();
}
Expand Down
18 changes: 18 additions & 0 deletions source/fundamentals/crud/read-operations/cursor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

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:"

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

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()

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

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

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


.. literalinclude:: /code-snippets/crud/cursor.js
:language: javascript
:start-after: start listIndexSearch example
:end-before: end listIndexSearch example


Stream API
~~~~~~~~~~

Expand Down