Query docs from an iDAI.field Database Based on a JSON-Query
Source:R/idf_query.R
idf_json_query.Rd
This function can be used to gather docs from an iDAI.field / Field Desktop Database using a JSON-Query as detailed by the CouchDB-API Docs.
Arguments
- connection
A connection object as returned by
connect_idaifield()
- query
A valid JSON-query as detailed in the relevant section of the CouchDB-API documentation.
- projectname
(deprecated) The name of the project to be queried (overrides the one listed in the connection-object).
See also
Learn how to build the selector-query with the CouchDB-API.
Alternative functions:
idf_query()
,idf_index_query()
Examples
if (FALSE) {
conn <- connect_idaifield(pwd = "hallo", project = "rtest")
# Get all documents that contain "Anna Allgemeinperson" as processor
query <- '{ "selector": { "resource.processor": ["Anna Allgemeinperson"] } }'
result <- idf_json_query(conn, query = query)
# Get all documents where hasRestoration is TRUE
query <- '{ "selector": { "resource.hasRestoration": true } }'
result <- idf_json_query(conn, query = query)
# Get all documents where hasRestoration is TRUE
# but only the fields *identifier* and *hasRestoration*
query <- '{ "selector": { "resource.hasRestoration": true },
"fields": [ "resource.identifier", "resource.hasRestoration" ] }'
result <- idf_json_query(conn, query = query)
}