Description Usage Arguments Details Value See Also Examples
Append a name/value pair into a mongo.bson.buffer.
1 | mongo.bson.buffer.append(buf, name, value)
|
buf |
(mongo.bson.buffer) The buffer object to which to append. |
name |
(string) The name (key) of the field appended to the buffer. |
value |
The value of the field. |
This function is a generic version of many 'append' functions. It will
detect the type of the value
parameter and perform the same action as
the specific functions. These functions are:
mongo.bson.buffer.append.int()
mongo.bson.buffer.append.string()
mongo.bson.buffer.append.bool()
mongo.bson.buffer.append.double()
mongo.bson.buffer.append.complex()
mongo.bson.buffer.append.null()
mongo.bson.buffer.append.undefined()
mongo.bson.buffer.append.symbol()
mongo.bson.buffer.append.code()
mongo.bson.buffer.append.code.w.scope()
mongo.bson.buffer.append.raw()
mongo.bson.buffer.append.time()
mongo.bson.buffer.append.timestamp()
mongo.bson.buffer.append.regex()
mongo.bson.buffer.append.oid()
mongo.bson.buffer.append.bson()
mongo.bson.buffer.append.element()
mongo.bson.buffer.append.list()
mongo.bson.buffer.append.long()
is missing from the above list
since R has no 64-bit long integer type. If you wish a value to be stored
in the BSON data as a long you must explicity call that function.
All of the above functions will lose the attributes of the object other than
"names". When vectors of length > 1 are appended, "names" are preserved.
mongo.bson.buffer.append.object()
gets around this shortcoming
and allows most R objects to be stored in a database without loss of
attributes.
TRUE if successful; otherwise, FALSE if an error occured appending the data.
mongo.bson,
mongo.bson.buffer.
1 2 3 4 5 6 7 8 | buf <- mongo.bson.buffer.create()
# Append a string
mongo.bson.buffer.append(buf, "name", "Joe")
# Append a date/time
mongo.bson.buffer.append(buf, "created", Sys.time())
# Append a NULL
mongo.bson.buffer.append(buf, "cars", NULL)
b <- mongo.bson.from.buffer(buf)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.