I have a mongo collection with documents. There is one field in every document which is 0 OR 1. I need to random sample 1000 records from the database and count the number of documents who have that field as 1. I need to do this sampling 1000 times. How do i do it ?
Share
Here’s an example in the
mongoshell .. assuming a collection ofcollname, and a value of interest inthefield: