I'm using Ubuntu 14.4 and MongoDB 2.6.6.
I'm writing a bash script and I'm using the following command:
mongo cc --eval "printjson(db.cc_data.count())"
to get the count of the collection cc_data. I would like to save the count returned in a variable, but I couldn't.