0

How can I find the number of documents in a collection using the RMongo package?

avidlearner
  • 243
  • 3
  • 16

1 Answers1

1

You could use the rmongodb package which has more recent updates.

Connect to your base (here localhost) and use mongo.count to count documents in a specific collection.

library(rmongodb)
mongo <- mongo.create() 
mongo.count(mongo = mongo, ns = coll_name) 

With the argument query you also could count document resulting of a specific query if you want.

cderv
  • 6,272
  • 1
  • 21
  • 31