/
docdb_update.Rd
50 lines (45 loc) · 1.22 KB
/
docdb_update.Rd
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/update.R
\name{docdb_update}
\alias{docdb_update}
\title{Update documents}
\usage{
docdb_update(src, key, value, ...)
}
\arguments{
\item{src}{source object, result of call to src}
\item{key}{(character) A key (collection for mongo)}
\item{value}{(data.frame) A single data.frame}
\item{...}{Ignored}
}
\description{
Update documents
}
\details{
Only CouchDB and sqlite supported for now
}
\examples{
\dontrun{
# CouchDB
src <- src_couchdb()
docdb_create(src, "mtcars2", mtcars)
docdb_get(src, "mtcars2")
mtcars$letter <- sample(letters, NROW(mtcars), replace = TRUE)
invisible(docdb_update(src, "mtcars2", mtcars))
docdb_get(src, "mtcars2")
# SQLite
src <- src_sqlite()
docdb_create(src, "mtcars",
data.frame("_id" = seq_len(nrow(mtcars)),
mtcars,
stringsAsFactors = FALSE,
check.names = FALSE))
dfupd <- data.frame("cyl" = 4, "gear" = 99,
stringsAsFactors = FALSE,
check.names = FALSE)
docdb_update(src, "mtcars", dfupd)
docdb_query(src, "mtcars",
query = '{"gear": {"$gt": 10}}',
fields = '{"gear": 1, "cyl": 1}')
}
}