Object built-in object

Object MongoCursor

mongodb database data cursor object

Inheritance

#lineWidth: 1.5 #font: Helvetica,sans-Serif #fontSize: 10 #leading: 1.6 #.this: fill=lightgray #.class: fill=white [<class>object|toString();toJSON()] [<this>MongoCursor|skip();limit();sort();hasNext();next();count();size();forEach();map();toArray();hint()] [object] <:- [MongoCursor] object toString() toJSON() MongoCursor skip() limit() sort() hasNext() next() count() size() forEach() map() toArray() hint()

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, Return 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, the number of records

Return result:

  • MongoCursor, Return 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, Return 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 there is 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, 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

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