Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated docs to include where method

  • Loading branch information...
commit 5c1e02f1f4fff3c24d2b98ae93e78bdf0f714c0d 1 parent b339b5d
@davidgtonge authored
Showing with 15 additions and 1 deletion.
  1. +15 −1 README.md
View
16 README.md
@@ -21,7 +21,10 @@ You can install with NPM: `npm install backbone-query`
Then simply require in your project: `QueryCollection = require("backbone-query").QueryCollection`
-Your collections will now have a `query` method that can be used like this:
+Your collections will now have two new methods: `query` and `where`. Both methods accept 2 arguments -
+a query object and an options object. The `query` method returns an array of models, but the `where` method
+returns a new collection and is therefore useful where you would like to chain multiple collection
+methods / where queries. The following are some basic examples:
```js
MyCollection.query({
@@ -68,6 +71,17 @@ MyCollection.query
colors: $contains: "yellow"
```
+Another CoffeeScript example, this time using `where` rather than `query`
+
+```coffeescript
+query =
+ $likes: $lt: 10
+ $downloads: $gt: 20
+
+MyCollection.where(query).my_custom_collection_method()
+```
+
+
Query API
===
Please sign in to comment.
Something went wrong with that request. Please try again.