File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,27 @@ You can skip the first results by setting `skip`. In the old Parse hosted backen
57
57
query .skip (10 ); // skip the first 10 results
58
58
```
59
59
60
+ If you want to know the total number of rows in a table satisfying your query, for e.g. pagination purposes - you can use ` withCount ` .
61
+
62
+ ** Note:** Enabling this flag will change the structure of response, see the example below.
63
+
64
+ Let's say you have 200 rows in a table called ` GameScore ` :
65
+
66
+ ``` javascript
67
+ const GameScore = Parse .Object .extend (" GameScore" );
68
+ const query = new Parse.Query (GameScore);
69
+
70
+ query .limit (25 );
71
+
72
+ const results = await query .find (); // [ GameScore, GameScore, ...]
73
+
74
+ // to include count:
75
+ query .withCount ();
76
+ const response = await query .find (); // { results: [ GameScore, ... ], count: 200 }
77
+ ```
78
+ ⚠️ Сount operations can be slow and expensive.
79
+ > If you only want to get the count without objects - use [ Counting Objects] ( #counting-objects ) .
80
+
60
81
For sortable types like numbers and strings, you can control the order in which results are returned:
61
82
62
83
``` javascript
You can’t perform that action at this time.
0 commit comments