Object built-in object

objectMongoCursor

mongodb database data cursor object

inheritance relationship

member function

skip

Specifies the number of records to skip when returning results

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

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

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

1
Boolean MongoCursor.hasNext();

return result:

  • Boolean, returns true if there is a record

next

Returns the next record of the current cursor

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

1
Integer 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)

1
Integer MongoCursor.size();

return result:

  • Integer, returns the total number of records

forEach

Traverse all records and call back the processing function

1
MongoCursor.forEach(Function func);

Call parameters:

  • func: Function, specifies the processing function

map

Traverse and process all records and return the processing results

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

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

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

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

1
Value MongoCursor.toJSON(String key = "");

Call parameters:

  • key: String, not used

return result:

  • Value, which returns a JSON-serializable value