Count multiple fileds in MongoDB using python

I have this simple mongodb query:

db.checks_reports_data_df8.find({"report_id": str(report["_id"])})

The collection checks_reports_data_df8 is having some fields like “success” (can be 0 or 1) and is_listed (can be 0 or 1).

What I need is to be able to get the counts of all fields where success = 1 as count_success and all fields where is_listed = 1 as count_listed.
The final result will be something like all the results from the query above + count_success and count_listed

I suppose that this can be done using the aggregation framework.


Download count.multiple.fileds.in.mongodb.using.python.zip
Direct Link


Download


Download count.multiple.fileds.in.mongodb.using.python.zip
Mediafire


Download


Download count.multiple.fileds.in.mongodb.using.python.zip
Zippyshare


Download


Download count.multiple.fileds.in.mongodb.using.python.zip
Uploadbaz


Download


Download count.multiple.fileds.in.mongodb.using.python.zip
Queenshare


Download

Both comments and pings are currently closed.

Comments are closed.