Description Usage Arguments Details Value See Also Examples
Call this function to start an array within a mongo.bson.buffer.
mongo.bson.buffer.finish.object()
must be called when finished
appending the elements of the array.
1 |
buf |
(mongo.bson.buffer) The buffer object to which to append. |
name |
(string) The name (key) of the array to be appended to the buffer. |
(mongo.bson.buffer.start.object()
,
mongo.bson.buffer.start.array()
) and
mongo.bson.buffer.finsih.object()
may be called in a stackwise (LIFO)
order to further nest arrays and documents.
The names of the elements appended should properly be given sequentially numbered strings.
Note that arrays will be automatically appended by the 'append' functions when appending vectors (containing more than one element) of atomic types.
TRUE if successful; otherwise, FALSE if an error occured appending the data.
mongo.bson,
mongo.bson.buffer,
mongo.bson.buffer.finish.object
,
mongo.bson.buffer.start.array
,
mongo.bson.buffer.append
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | buf <- mongo.bson.buffer.create()
mongo.bson.buffer.start.array(buf, "Fibonacci")
x <- 0
mongo.bson.buffer.append.int(buf, "0", x)
y <- 1
mongo.bson.buffer.append.int(buf, "1", y)
for (i in 2:8) {
z <- x + y
mongo.bson.buffer.append.int(buf, as.character(i), z)
x <- y
y <- z
}
mongo.bson.buffer.finish.object(buf)
b <- mongo.bson.from.buffer(buf)
# the above produces a BSON object of the form:
# { "Fibonacci" : [ 0, 1, 1, 2, 3, 5, 8, 13, 21 ] }
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.