Closed davedkg closed 12 years ago
rmongodb doesn't directly support distinct, but it can be easily implemented like so:
mongo.distinct <- function(mongo, db, collection, key) { b <- mongo.command(mongo, db, list(distinct=collection, key=key)) if (!is.null(b)) b <- mongo.bson.value(b, "values") b }
Thank you. That worked.
Is there a way to do a distinct find all? I tried mongo.distinct() but it's not in api_mongo.h.
Thanks,
dkg