Object built-in object

Object MongoCursor

mongodb database data cursor object

Inheritance

Member function

skip

Specify the number of records to skip when returning results

1
MongoCursor MongoCursor.skip(Integer num) async;

Call parameters:

  • num : Integer, the number of records

Return result:

  • MongoCursor , returns the cursor object itself to facilitate chain calls

limit

Specify the maximum number of records to return results

1
MongoCursor MongoCursor.limit(Integer size) async;

Call parameters:

  • size : Integer, number of records

Return result:

  • MongoCursor , returns the cursor object itself to facilitate chain calls

sort

Set the order of returned results

1
MongoCursor MongoCursor.sort(Object opts);

Call parameters:

  • opts : Object, specify sort criteria

Return result:

  • MongoCursor , returns the cursor object itself to facilitate chain calls

hasNext

Query whether the current cursor has the next record

1
Boolean MongoCursor.hasNext();

Return result:

  • Boolean , return true if there is a record

next

Return the next record of the current cursor

1
Object MongoCursor.next();

Return result:

  • Object , record object, return null if no record

count

Query the total number of records of the 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, 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)

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, specify the processing function

map

Traverse all records and return the processing result

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

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

1
MongoCursor MongoCursor.hint(Object opts);

Call parameters:

  • opts : Object, specify the mandatory index

Return result:

  • MongoCursor , returns 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

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

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

Call parameters:

  • key : String, unused

Return result:

  • Value , returns a value containing JSON serializable