mongo.distinct: Get a vector of distinct values for keys in a collection

Description Usage Arguments Details Value See Also Examples

View source: R/mongo_high_level.R

Description

Get a vector of distinct values for keys in a collection.

Usage

1

Arguments

mongo

(mongo) A mongo connection object.

ns

(string) The namespace of the collection in which to find distinct keys.

key

(string) The name of the key field for which to get distinct values.

query

mongo.bson An optional query to restrict the returned values.

Details

See http://www.mongodb.org/display/DOCS/Aggregation#Aggregation-Distinct.

Value

vector of distinct values or NULL if the command failed.

(vector) The result set of distinct keys.

See Also

mongo.command,
mongo.simple.command,
mongo.find,
mongo.

Examples

1
2
3
4
5
mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
    keys <- mongo.distinct(mongo, "test.people", "name")
    print(keys)
}

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