Object MongoCursor
mongodb database data cursor object
Inheritance
Member function
skip
Specify the number of records to skip when returning results
1MongoCursor MongoCursor.skip(Integer num) async;
Call parameters:
- num: Integer, the number of records
Return result:
- MongoCursor, Return the cursor object itself to facilitate chain calls
limit
Specify the maximum number of records to return results
1MongoCursor MongoCursor.limit(Integer size) async;
Call parameters:
- size: Integer, the number of records
Return result:
- MongoCursor, Return the cursor object itself to facilitate chain calls
sort
Set the order of returned results
1MongoCursor MongoCursor.sort(Object opts);
Call parameters:
- opts: Object, specify sort criteria
Return result:
- MongoCursor, Return the cursor object itself to facilitate chain calls
hasNext
Query whether the current cursor has the next record
1Boolean MongoCursor.hasNext();
Return result:
- Boolean, Return true if there is a record
next
Return the next record of the current cursor
1Object MongoCursor.next();
Return result:
- Object, Record object, return null if there is no record
count
Query the total number of records of the cursor
1Integer MongoCursor.count(Boolean applySkipLimit = false);
Call parameters:
- applySkipLimit: Boolean, specify whether to query the number of records after skip and limit, the default is false, query the total number of records
Return result:
- Integer, Returns the total number of records
size
Query the total number of records of the cursor, equivalent to count(true)
1Integer MongoCursor.size();
Return result:
- Integer, Returns the total number of records
forEach
Traverse all records and call back the processing function
1MongoCursor.forEach(Function func);
Call parameters:
- func: Function, specify the processing function
map
Traverse all records and return the processing result
1Array MongoCursor.map(Function func);
Call parameters:
- func: Function, specify the processing function
Return result:
- Array, Returns an array of processing results
toArray
Returns an array of all records of the current cursor
1Array MongoCursor.toArray();
Return result:
- Array, Returns a Javascript array containing all data
hint
Modify the default index strategy of mongodb server, use the specified index for query
1MongoCursor MongoCursor.hint(Object opts);
Call parameters:
- opts: Object, specify the mandatory index
Return result:
- MongoCursor, Return the cursor object itself to facilitate chain calls
toString
Returns the string representation of the object, generally returns "[Native Object]", the object can be re-implemented according to its own characteristics
1String MongoCursor.toString();
Return result:
- String, Returns the string representation of the object
toJSON
Returns the JSON format representation of the object, generally returns a collection of readable attributes defined by the object
1Value MongoCursor.toJSON(String key = "");
Call parameters:
- key: String, unused
Return result:
- Value, Returns a value containing JSON serializable