I have a mongo db with companies with the following data structure:
{'Beschreibung': [],
'Branche': ['Doctor'],
'Homepage': 'http://www.doctorsdomain.de',
'Mail': None,
'Name': ['Companyname'],
'Ort': 'Doctors City',
'PLZ': '12345 ',
'StrHausnummer': 'Doctors Street',
'Telefonnummer': '1235345646',
'_id': ObjectId('sadfsdfawdfawedfbad5f'),
'domain': 'doctorsdomain',
'doctors': [{'Salutation': 'Dear Madame', 'Name': 'Maximiliane Mustermann'},
{'Salutation': 'Dear Mister', 'Name': 'Bernd Beispiel'}],
'other information'
I don't find the query to count how many names (doctors) I have in my database.
I tried something like
collection.find({"doctors":{"$exists":1}}).count()
but than I only get the number of the companies where doctors exists.
Need help please!
Thanks a lot!
{"$match":{"doctors":{"$exists":1}}}to only look for documents where doctors array is present.