forked from mongodb-labs/sleepy.mongoose
-
Notifications
You must be signed in to change notification settings - Fork 1
Querying
efyx edited this page May 11, 2012
·
7 revisions
http://localhost:27080/dbname/cname/_find
Query for documents. See also Getting More Results.
GET
-
criteria=search_criteria
(object) -
fields=fields_to_return
(object) -
sort=sort_fields
(object) -
skip=num
(number) -
limit=num
(number) explain=true
-
batch_size=num_to_return
(number)
{"ok" : 1, "results" : [{...}, ... ], "id" : cursor_id}
Find all documents in the foo.bar namespace.
$ curl -X GET 'http://localhost:27080/foo/bar/_find'
Find document with object id “4f8c6f05db61e2a72600001d”.
$ curl -X GET 'http://localhost:27080/foo/bar/_find?criteria={"_id":{"$oid":"4f8c6f05db61e2a72600001d"}}'
Find all documents in the foo.bar namespace and sort by x descending
$ curl -X GET 'http://localhost:27080/foo/bar/_find?sort=%7B%22x%22%3A-1%7D'
Decoded, we’re really requesting http://localhost:27080/foo/bar/_find?sort={"x":-1}