db_explain: Explain API

Description Usage Arguments Value Examples

Description

Explain API

Usage

1
2
3
db_explain(cushion, dbname, query = NULL, selector = NULL, limit = NULL,
  skip = NULL, sort = NULL, fields = NULL, use_index = NULL,
  as = "list", ...)

Arguments

cushion

A Cushion object. Required.

dbname

Database name

query

(character) instead of using the other parameters, you can compose one R list or json blob here

selector

(json) - JSON object describing criteria used to select documents. More information provided in the section on selector syntax. See the query_tutorial in this package, and the selectors docs http://docs.couchdb.org/en/2.0.0/api/database/find.html#find-selectors

limit

(number) - Maximum number of results returned. Default is 25. Optional

skip

(number) - Skip the first 'n' results, where 'n' is the value specified. Optional

sort

(json) - JSON array following sort syntax. Optional. See http://docs.couchdb.org/en/2.0.0/api/database/find.html#find-sort For some reason, sort doesn't work often, not sure why.

fields

(json) - JSON array specifying which fields of each object should be returned. If it is omitted, the entire object is returned. More information provided in the section on filtering fields. Optional See http://docs.couchdb.org/en/2.0.0/api/database/find.html#find-filter

use_index

(json) - Instruct a query to use a specific index. Specified either as "<design_document>" or ["<design_document>", "<index_name>"]. Optional

as

(character) One of list (default) or json

...

Curl args passed on to one of the HTTP verbs (e.g,. GET, POST, PUT, etc.)

Value

JSON as a character string or a list (determined by the as parameter)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 
## create a connection
(x <- Cushion$new())

file <- system.file("examples/omdb.json", package = "sofa")
strs <- readLines(file)

## create a database
if ("omdb" %in% db_list(x)) {
  invisible(db_delete(x, dbname="omdb"))
}
db_create(x, dbname='omdb')

## add some documents
invisible(db_bulk_create(x, "omdb", strs))

## query all in one json blob
db_explain(x, dbname = "omdb", query = '{
  "selector": {
    "_id": {
      "$gt": null
    }
  }
}')

## End(Not run)


Search within the sofa package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.