-
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
Changes from 6 commits
c2a5560
6f16227
cd551bd
93e332e
b3bcf76
9363c6c
314d3c0
c4e33d5
0173472
7c177b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. I: Isn't this the wrong method name?
Suggested change
|
||||||
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({}); | ||||||
|
||||||
|
@@ -80,6 +90,7 @@ async function run() { | |||||
await fetchAll(orders); | ||||||
await rewind(orders); | ||||||
await count(orders); | ||||||
//await listIndexSearch(orders); | ||||||
} finally { | ||||||
await client.close(); | ||||||
} | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 S: Move this section to Indexes and add information also about using |
||||||||||||||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||||||||||
|
||||||||||||||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
<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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more. S link the API documentation for |
||||||||||||||||||
|
||||||||||||||||||
.. literalinclude:: /code-snippets/crud/cursor.js | ||||||||||||||||||
:language: javascript | ||||||||||||||||||
:start-after: start listIndexSearch example | ||||||||||||||||||
:end-before: end listIndexSearch example | ||||||||||||||||||
|
||||||||||||||||||
|
||||||||||||||||||
Stream API | ||||||||||||||||||
~~~~~~~~~~ | ||||||||||||||||||
|
||||||||||||||||||
|
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.