Skip to content
efyx edited this page May 11, 2012 · 7 revisions

Usage

http://localhost:27080/dbname/cname/_find

Description

Query for documents. See also Getting More Results.

Request Type

GET

Optional Arguments

  • 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)

Return Values

{"ok" : 1, "results" : [{...}, ... ], "id" : cursor_id}

Example: Basic Find

Find all documents in the foo.bar namespace.

$ curl -X GET 'http://localhost:27080/foo/bar/_find'

Example: Find on ObjectId

Find document with object id “4f8c6f05db61e2a72600001d”.

$ curl -X GET 'http://localhost:27080/foo/bar/_find?criteria={"_id":{"$oid":"4f8c6f05db61e2a72600001d"}}'

Example: Find with Sort

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}