Skip to content

Commit

Permalink
Add .exclude() example to JS Guide
Browse files Browse the repository at this point in the history
Added example of Query.exclude() in `js/queries.md`
Closes parse-community#632
  • Loading branch information
RaschidJFR committed Jul 26, 2019
1 parent b45c149 commit 094451f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion _includes/js/queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ You can skip the first results by setting `skip`. In the old Parse hosted backen
query.skip(10); // skip the first 10 results
```

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`.
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`.

**Note:** Enabling this flag will change the structure of response, see the example below.

Expand Down Expand Up @@ -176,6 +176,18 @@ query.find().then(function(results) {
});
```

Similarly, use `exclude` to remove undesired fields while retrieving the rest:

```javascript
var GameScore = Parse.Object.extend("GameScore");
var query = new Parse.Query(GameScore);
query.exclude("playerName");
query.find().then(function(results) {
// Now each result will have all fields except `playerName`
});
```


The remaining fields can be fetched later by calling `fetch` on the returned objects:

```javascript
Expand Down

0 comments on commit 094451f

Please sign in to comment.