Description Usage Arguments Details Value See Also Examples
Converts a mongo cursor object to a list by interating over all cursor objects and combining them. It doesn't make any data coercion!, just one-to-one mapping with documents in source collection.
1 | mongo.cursor.to.list(cursor, keep.ordering = TRUE)
|
cursor |
(mongo.cursor) A mongo.cursor object returned from |
keep.ordering |
should the records be returned at the same order as fetched from cursor (if sorting was specified in query)? For speed try to set this parameter to FALSE. This will prevent sorting after fetching from cursor. |
Since rmongodb 1.8.0 function uses environments to avoid extra copying, so now it is much faster.
An R list object.
1 2 3 4 5 6 7 8 9 10 11 12 13 | mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.append(buf, "age", 22L)
query <- mongo.bson.from.buffer(buf)
# Find the first 100 records
# in collection people of database test where age == 22
cursor <- mongo.find(mongo, "test.people", query, limit=100L)
res <- mongo.cursor.to.list(cursor)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.