mongo.cursor.to.data.frame: Convert Mongo Cursor Object to Data.Frame

Description Usage Arguments Details Value See Also Examples

View source: R/mongo_cursor.R

Description

Converts a mongo cursor object to a data.frame by interating over all cursor objects and combining them.

Usage

1
mongo.cursor.to.data.frame(cursor, nullToNA = TRUE, ...)

Arguments

cursor

(mongo.cursor) A mongo.cursor object returned from mongo.find().

nullToNA

(boolean) If NULL values will be torned into NA values. Usually this is a good idea, because sporadic NULL values will cause structural problems in the data.frame, whereas NA values will just appear as regular NAs.

...

Additional parameters parsed to the function as.data.frame

Details

Note that mongo.oid columns will be removed. data.frame can not deal with them.

Value

An R data.frame object.

See Also

mongo.find,
as.data.frame.

Examples

 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.data.frame(cursor)

}

jonkatz2/rmongodb documentation built on May 19, 2019, 7:30 p.m.