I need to store update coverage for messages in MongoDB.
I'm getting the updated/total messages and then * 100 so I can get the percentage
total 119 updated 6
The result will be 5.042016806722689
How can I store it as 5.04
? Is there any way to store it like that?
updates_coverage = (updated_event_query / total_event_query) * 100
The insertion code is:
inserted_results_collection.insert_one({"updates_coverage": collection.updates_coverage})
CodePudding user response:
updates_coverage = round(((updated_event_query / total_event_query) * 100),2)