mongo.bson.buffer.append.bson: Append a mongo.bson object into a mongo.bson.buffer

Description Usage Arguments Details Value See Also Examples

View source: R/bson.R

Description

Append a mongo.bson object into a mongo.bson.buffer as a subobject.

Usage

1

Arguments

buf

(mongo.bson.buffer) The buffer object to which to append.

name

(string) The name (key) of the subobject field appended to the buffer.

value

(mongo.bson) a mongo.bson object.

Details

Note that mongo.bson.buffer.append() will detect if its value parameter is a mongo.bson object and perform the same action as this function.

Value

TRUE if successful; otherwise, FALSE if an error occured appending the data.

See Also

mongo.bson,
mongo.bson.buffer,
mongo.bson.from.list,
mongo.bson.buffer.append.

Examples

1
2
3
4
5
6
7
8
name <- mongo.bson.from.list(list(first="Joe", last="Smith"))
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.append.bson(buf, "name", name)
mongo.bson.buffer.append.string(buf, "city", "New York")
b <- mongo.bson.from.buffer(buf)

# the above will create a mongo.bson object of the following form:
# { "name" : { "first" : "Joe", "last" : "Smith" }, "city" : "New York" }

jonkatz2/rmongodb documentation built on May 19, 2019, 7:30 p.m.