rmongodb (version 1.8.0)

mongo.cursor.value: Fetch the current value of a cursor

Description

mongo.cursor.value(cursor) is used to fetch the current record belonging to a mongo.find() query.

Usage

mongo.cursor.value(cursor)

Arguments

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

Value

(mongo.bson) The current record of the result set.

See Also

mongo.find, mongo.cursor, mongo.cursor.next, mongo.cursor.value, mongo.cursor.destroy, mongo.bson.

Examples

Run this code
mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
    buf <- mongo.bson.buffer.create()
    mongo.bson.buffer.append(buf, "city", "St. Louis")
    query <- mongo.bson.from.buffer(buf)

    # Find the first 1000 records in collection people
    # of database test where city == "St. Louis"
    cursor <- mongo.find(mongo, "test.people", query, limit=1000L)
    # Step though the matching records and display them
    while (mongo.cursor.next(cursor))
        print(mongo.cursor.value(cursor))
    mongo.cursor.destroy(cursor)
}

Run the code above in your browser using DataLab