Description Usage Arguments Value See Also Examples
Append an integer or vector of integers onto a mongo.bson.buffer.
1 | mongo.bson.buffer.append.int(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 |
(integer vector) The integer(s) to append to the buffer. If value has a If value has a names attribute, a subobject is appended and the subfields are given the indicated names. Otherwise, if more than one element is present in value it must be a vector of integers and the integers are appended as a subarray. In the last case, the single value must be coerible to an integer. |
TRUE if successful; otherwise, FALSE if an error occured appending the data.
mongo.bson,
mongo.bson.buffer,
mongo.bson.buffer.append
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | buf <- mongo.bson.buffer.create()
mongo.bson.buffer.append.int(buf, "age", 23L)
b <- mongo.bson.from.buffer(buf)
# the above produces a BSON object of the form { "age" : 21 }
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.append.int(buf, "ages", c(21L, 19L, 13L))
b <- mongo.bson.from.buffer(buf)
# the above produces a BSON object of the form { "ages" : [21, 19, 13] }
buf <- mongo.bson.buffer.create()
dim <- c(2L, 4L, 8L)
names(dim) <- c("width", "height", "length")
mongo.bson.buffer.append.int(buf, "board", dim)
b <- mongo.bson.from.buffer(buf)
# theabove produces a BSON object of the form:
# { "board" : { "width" : 2, "height" : 4, "length" : 8 } }
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.