Skip to content

Commit

Permalink
Add refineSearch to the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcath committed Apr 20, 2016
1 parent df27ed5 commit 46a0c25
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/finding_data.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ results.length // 1
results[0].name // jorge
```

You can refine a search later if you need to by using `refineSearch`

```javascript
results = db.where({height: {lt: 100}})
results.length // 4
results2 = db.refineSearch(results, {eyes: 2})
results2.length //1
```

If you need all entries from the database you can fetch them through .all()

```javascript
Expand Down
5 changes: 5 additions & 0 deletions tests/docs-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ describe('Code Used in the Docs', function(){
expect(results.length).to.equal(1);
expect(results[0].name).to.equal('jorge');

results = db.where({height: {lt: 100}});
expect(results.length).to.equal(4);
results2 = db.refineSearch(results, {eyes: 2});
expect(results2.length).to.equal(1);

results = db.where({friends: {includes: 'jorge'}})
expect(results.length).to.equal(2);

Expand Down

0 comments on commit 46a0c25

Please sign in to comment.