Field returned by the query
Previously, crud mentioned only selector, but field_selection was not mentioned. In fact, the find () method has two parameters. By default, the second parameter is *, that is, all fields are returned. If you want to return only the specified field, you can write dB. coooooolection. Find ({null, {field1: 1, field2: 2 });. It must be mentioned that "_ id" is a field that must be returned and is numbered 0.
Bytes -------------------------------------------------------------------------------------
Sort
The sort () method has a parameter that specifies who to sort. For example, {field1: 1} is sorted in ascending order by field1; {field1: 1, field2: -1} is to sort by field1 in ascending order and then by field2 in descending order. Of course, it is important to note that if you want to sort massive data, sort is limited, that is, you can only sort the fields that can be indexed. Otherwise, A system error is returned.
Bytes -------------------------------------------------------------------------------------
Paging
The limit (number) and skip (number) methods are used to control paging. Limit determines the maximum number of returned documents. The Skip determines how many documents are skipped and the document is returned. Here, we also need to mention that the limit method is best followed by the sort method, so as to avoid errors in some non-indexed field operations.
Bytes -------------------------------------------------------------------------------------
Count
You can call the count () method to obtain the number of statements returned.