rmongodb (version 1.8.0)

mongo.bson: The mongo.bson class

Description

Objects of class "mongo.bson" are used to store BSON documents. BSON is the form that MongoDB uses to store documents in its database. MongoDB network traffic also uses BSON in messages.

Arguments

Details

See http://www.mongodb.org/display/DOCS/BSON.

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

Objects of class "mongo.bson.iterator" are used to iterate over a mongo.bson object to enumerate its keys and values.

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

See Also

mongo.bson.from.list, mongo.bson.to.list, mongo.bson.iterator, mongo.bson.buffer, mongo.bson.from.buffer, mongo.bson.empty, mongo.find.one, mongo.bson.destroy, link{mongo.shorthand}.

Examples

Run this code
b <- mongo.bson.from.list(list(name="Fred", age=29, city="Boston"))
iter <- mongo.bson.iterator.create(b)  # b is of class "mongo.bson"
while (mongo.bson.iterator.next(iter))
    print(mongo.bson.iterator.value(iter))

Run the code above in your browser using DataLab