Learn R Programming

rmongodb (version 1.8.0)

mongo.bson.buffer.size: Get the size of a mongo.bson.buffer object

Description

Get the number of bytes which would be taken up by the BSON data when the buffer is converted to a mongo.bson object with mongo.bson.from.buffer().

Usage

mongo.bson.buffer.size(buf)

Arguments

buf
(mongo.bson.buffer) the mongo.bson.buffer object to examine.

Value

(integer) the number of bytes which would be taken up by the BSON data with the buffer is converted to a mongo.bson object with mongo.bson.from.buffer().

See Also

mongo.bson.buffer, mongo.bson.

Examples

Run this code
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.append(buf, "name", "Fred")
mongo.bson.buffer.append(buf, "city", "Dayton")
# both should report 37
print(mongo.bson.buffer.size(buf))
y <- mongo.bson.from.buffer(buf)
print(mongo.bson.size(y))

Run the code above in your browser using DataLab