Learn R Programming

rmongodb (version 1.8.0)

mongo.bson.buffer: The mongo.bson.buffer class

Description

Objects of class "mongo.bson.buffer" are used to build BSON documents (mongo.bson objects).

Arguments

Details

There are many functions for appending data into a mongo.bson.buffer object. See mongo.bson.buffer.append() for a list of those functions.

After constructing your object in the buffer, mongo.bson.from.buffer() may be used to turn the buffer into a mongo.bson object.

mongo.bson.buffer objects have "mongo.bson.buffer" as their class and contain an externally managed pointer to the actual document data buffer. This pointer is stored in the "mongo.bson.buffer" attribute of the object.

See Also

mongo.bson, mongo.bson.buffer.size, mongo.bson.from.buffer, mongo.bson.buffer.append, mongo.bson.buffer.start.object, mongo.bson.buffer.start.array, mongo.bson.buffer.finish.object.

Examples

Run this code
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.append(buf, "make", "Ford")
mongo.bson.buffer.append(buf, "model", "Mustang")
mongo.bson.buffer.append.int(buf, "year", 1968)
b <- mongo.bson.from.buffer(buf)

Run the code above in your browser using DataLab