Learn R Programming

rmongodb (version 1.8.0)

mongo.bson.buffer.append.list: Append a list onto a mongo.bson.buffer

Description

Append a list onto a mongo.bson.buffer.

Usage

mongo.bson.buffer.append.list(buf, name, value)

Arguments

buf
(mongo.bson.buffer) The buffer object to which to append.
name
(string) The name (key) of the field appended to the buffer.
value
(list) The list to append to the buffer as a subobject.

Value

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

Details

Note that the value parameter must be a true list, not an vector of a single atomic type.

Also note that this function is recursive and will append items that are lists themselves as subobjects.

See Also

mongo.bson, mongo.bson.buffer, mongo.bson.buffer.append.

Examples

Run this code
buf <- mongo.bson.buffer.create()
l <- list(fruit = "apple", hasSeeds = TRUE)
mongo.bson.buffer.append.list(buf, "item", l)
b <- mongo.bson.from.buffer(buf)

# this produces a BSON object of the form:
# { "item" : { "fruit" : "apple", "hasSeeds" : true } }

Run the code above in your browser using DataLab