Title: | Query MongoDB Documents with R |
---|---|
Description: | Translate R code into MongoDB aggregation pipelines. |
Authors: | Oliver Haag [aut, cre] |
Maintainer: | Oliver Haag <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1 |
Built: | 2024-11-29 08:49:44 UTC |
Source: | CRAN |
Create or append a mongo aggregation stage
add_stage(x, ...) ## Default S3 method: add_stage(x, ...) ## S3 method for class 'mongopipe' add_stage(x, type, ...)
add_stage(x, ...) ## Default S3 method: add_stage(x, ...) ## S3 method for class 'mongopipe' add_stage(x, type, ...)
x |
Object of class mongo or mongo_pipe |
... |
query |
type |
Name of the stage. |
Object of type mongopipe.
Evaluates a boolean expression to return one of the two specified return expressions.
condition(test, yes, no)
condition(test, yes, no)
test |
Expression which returns a boolean value. |
yes |
Return this if the test returns true. |
no |
Return this if the test returns false. |
Return a list for using in mongopipe.
## Not run: cond <- condition(test = list("$isArray"="$chart"), yes = list("$size"="$chart"), no = 0) jsonlite::toJSON(cond) ## End(Not run)
## Not run: cond <- condition(test = list("$isArray"="$chart"), yes = list("$size"="$chart"), no = 0) jsonlite::toJSON(cond) ## End(Not run)
These functions translate R code to json readably by Mongodb.
match(x, ...) ## S3 method for class 'mongopipe' match(x, ...) field(x, ...) ## S3 method for class 'mongopipe' field(x, ...) lookup(x, ...) ## S3 method for class 'mongopipe' lookup(x, from, local_field = from, foreign_field = "_id", as = from, ...) unwind(x, ...) ## S3 method for class 'mongopipe' unwind(x, field, ...) limit(x, ...) ## S3 method for class 'mongopipe' limit(x, limit, ...) project(x, ...) ## S3 method for class 'mongopipe' project(x, ...)
match(x, ...) ## S3 method for class 'mongopipe' match(x, ...) field(x, ...) ## S3 method for class 'mongopipe' field(x, ...) lookup(x, ...) ## S3 method for class 'mongopipe' lookup(x, from, local_field = from, foreign_field = "_id", as = from, ...) unwind(x, ...) ## S3 method for class 'mongopipe' unwind(x, field, ...) limit(x, ...) ## S3 method for class 'mongopipe' limit(x, limit, ...) project(x, ...) ## S3 method for class 'mongopipe' project(x, ...)
x |
Object of class |
... |
list object |
from |
Collection to join |
local_field |
Field from the input documents |
foreign_field |
Field from the documents of the "from" collection |
as |
Name of output array field (Default: |
field |
Field to unwind. |
limit |
Integer to limit the number of documents. |
Object of type mongopipe.