Oct-28-2020, 06:25 PM
Hi
Iam a beginner in python coding. I have a requirement to get the count from one column which is of Object type from mongodb. Below is the code which i have tried getting the value as 0.Could you please help.
db.getCollection('Datatable').find({"metaData.status" : "VALID"}).count()
342045
Iam a beginner in python coding. I have a requirement to get the count from one column which is of Object type from mongodb. Below is the code which i have tried getting the value as 0.Could you please help.
from pymongo import MongoClient
from pprint import pprint
conn = MongoClient("xx.xx.xx.xx:27017")
with conn:
db=conn.travel.Datatable
propertyCount=db.find({"metadata.status" : "VALID"}).count()
pprint(propertyCount)When running the query in robomongo the result is as follows.db.getCollection('Datatable').find({"metaData.status" : "VALID"}).count()
342045
