Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

SDK Database Collection Index


May 20, 2021 WeChat Mini Program Development Document


Table of contents


Collection

The database collection reference

Method

Collection.doc(id: string): Document

Gets a reference to the specified record in the collection. The method accepts an id parameter that specifies the value of the record to _id.

Collection.add(options: Object): Promise<Object>

New records, _id is automatically generated by the background if the incoming record object does not have an _id field, and _id cannot conflict with an existing record if _id is specified

Collection.aggregate(): Aggregate

To initiate an aggregation operation, you need to call the end method flag to end the definition and actually initiate the aggregation operation after defining the aggregation pipeline stage

Collection.count(): Promise<Object>

Count the number of bars that match the query criteria

Collection.field(projection: Object): Collection

Specifies the fields that need to be returned for the record in the return result

Collection.get(): Promise<Object>

Get collection data, or get collection data that is filtered based on query criteria.

Collection.limit(value: number): Collection

Specifies the maximum number of query result sets

Collection.orderBy(fieldPath: string, string: order): Collection

Specify the query sort criteria

Collection.remove(): Promise<Object>

Delete multiple records. Note that skip and limit are only supported for deletion by matching where statements.

Collection.skip(offset: number): Collection

When a specified query returns results, it starts with the results of the specified sequence and is often used for plying

Collection.update(): Promise<Object>

Update multiple records

Collection.watch(options: Object): Object

Listen for update events for data in the collection that meets the query criteria. Where, orderBy, limit, field is not supported when using watch.

Collection.where(condition: Object): Collection

Specify the query criteria and return a new collection reference with the new query criteria