Skip to content
This repository has been archived by the owner on Oct 15, 2018. It is now read-only.

Update method find. Added fields to return/fetch option. #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion queries/query-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,27 @@ return a chainable object.

## CRUD Methods

### .find( `criteria`, [`callback`] )
### .find( `criteria`, [`fieldsToReturn`], [`callback`] )

`find` will return an array of records that match the supplied criteria. Criteria can be built
using the [Query Language](query-language.md).

| Description | Accepted Data Types | Required ? |
|--------------------|---------------------------------|------------|
| Find Criteria | `{}`,`[{}]`, `string`, `int` | Yes |
| Fields to return | `{}` | No |
| Callback | `function` | No |

```javascript
User.find({ name: 'Walter Jr' })
.exec(function(err, users) {});
```

```javascript
User.find({name: 'Walter Jr'}, {fields: ['name', 'age', 'email']})
.exec(function(err, users){});
```

##### Notes

> Any string arguments passed must be the ID of the record.
Expand Down