Factory function that creates an instance of a statement to search
for documents in a collection.
- Mixes In:
- See:
Methods
-
execute( [dataCursor])
-
Executes the statement in the database that searches for all documents in the collection that match the given criteria. If a push-based cursor is provided, it should be used to iterate over the documents in result set.
Parameters:
Name Type Argument Description dataCursor
module:CollectionFind~documentCursor <optional>
Callback function that works as push-based cursor to iterate over the result set. Returns:
Promise
that resolves to an object containing the result set returned by the statement and any other detail reported by the server. If a push-based cursor is provided, the result set will be empty.- Type
- Promise.<module:DocResult>
-
fields(projectedDocumentsExprStr)
-
Selects one or more document fields to be part of the result set. This method does not cause the statement to be executed but changes the statement boundaries, which means that if it has been prepared before, it needs to be re-prepared.
Parameters:
Name Type Argument Description projectedDocumentsExprStr
ProjectedDocumentsExprStr <repeatable>
One or more field names and aliases or computed projection expressions. Returns:
The instance of the statement itself following a fluent API convention.
Type Definitions
-
documentCursor(object)
-
Push-based cursor type used to iterate over documents in a result set returned when searching in a collection.
Parameters:
Name Type Description object
Object Plain JavaScript object, in the current cursor position, that represents a local instance of the corresponding document.