objectMongoCursor
mongodb database data cursor object
inheritance relationship
member function
skip
Specifies the number of records to skip when returning results
1MongoCursor MongoCursor.skip(Integer num) async;
Call parameters:
- num: Integer, number of records
return result:
- MongoCursor, returns the cursor object itself for chain calls
limit
Specifies the maximum number of records to return
1MongoCursor MongoCursor.limit(Integer size) async;
Call parameters:
- size: Integer, number of records
return result:
- MongoCursor, returns the cursor object itself for chain calls
sort
Set the sorting of returned results
1MongoCursor MongoCursor.sort(Object opts);
Call parameters:
- opts: Object, specify the sorting condition
return result:
- MongoCursor, returns the cursor object itself for chain calls
hasNext
Query whether the current cursor has the next record
1Boolean MongoCursor.hasNext();
return result:
- Boolean, returns true if there is a record
next
Returns the next record of the current cursor
1Object MongoCursor.next();
return result:
- Object, the record object, if there is no record, return null
count
The total number of records for the query 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, and query all the 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, specifies the processing function
map
Traverse and process all records and return the processing results
1Array MongoCursor.map(Function func);
Call parameters:
- func: Function, specifies 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 the mongodb server and use the specified index for query
1MongoCursor MongoCursor.hint(Object opts);
Call parameters:
- opts: Object, specifies the mandatory index
return result:
- MongoCursor, returns the cursor object itself for chain calls
toString
Return the string representation of the object, generally return "[Native Object]", the object can be reimplemented according to its own characteristics
1String MongoCursor.toString();
return result:
- String, returns a string representation of the object
toJSON
Returns the JSON format representation of the object, generally returns a collection of readable properties defined by the object
1Value MongoCursor.toJSON(String key = "");
Call parameters:
- key: String, not used
return result:
- Value, which returns a JSON-serializable value