Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/concepts/ORM/Querylanguage.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,30 @@ _For performance reasons, case-sensitivity of `endsWith` depends on the database
Query options allow you refine the results that are returned from a query. They are used
in conjunction with a `where` key. The current options available are:

* `select`
* `omit`
* `limit`
* `skip`
* `sort`

#### Select

Chooses which attributes to return from a query. Note that `id` is always
returned, even if not included in the `select` list.

```usage
Model.find({ select: ['name'] })
```

#### Omit

Chooses which attributes to omit from a query. All attributes except for the
given attributes will be returned.

```usage
Model.find({ omit: ['middleName'] })
```

#### Limit

Limits the number of results returned from a query.
Expand Down
30 changes: 30 additions & 0 deletions docs/reference/waterline/queries/omit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# `.omit()`

Indicate which attributes to omit from the query. All attributes except for the
given attributes will be returned.

```usage
.omit(attributesToOmit)
```


### Usage

| | Argument | Type | Details |
|---|:------------------|-----------|------------|
| 1 | attributesToOmit | ((array)) | The names of fields to omit. |


### Example

To retrieve all attributes but `password` from the user named Rosa:

```javascript
var rosa = await User.findOne({ name: 'Rosa' })
.omit(['password'])

return res.json(rosa);
```

<docmeta name="displayName" value=".omit()">
<docmeta name="pageType" value="method">
30 changes: 30 additions & 0 deletions docs/reference/waterline/queries/select.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# `.select()`

Indicate which attributes to select from the query. All attributes except for the
given attributes will be returned.

```usage
.select(attributesToInclude)
```


### Usage

| | Argument | Type | Details |
|---|:---------------------|-----------|------------|
| 1 | attributesToInclude | ((array)) | The names of fields to select. |


### Example

To retrieve only `name` from the user with id 1234

```javascript
var userInfo = await User.findOne({ id: 1234 })
.select(['name'])

return res.json(userInfo);
```

<docmeta name="displayName" value=".select()">
<docmeta name="pageType" value="method">