N
N
novicheck2016-07-11 11:31:49
Python
novicheck, 2016-07-11 11:31:49

How to get value from cursor in pymongo?

print(db.events.aggregate([{"$match": {"is_buyer": 1, "status": 'start'}},
{"$group": {'_id': "$eventName", 'total ': {'$sum': 1}}},
{"$sort": {'_id': 1}}
]))
this code prints me a cursor, and I need to get the value (what is stored in the cursor). Please advise how to achieve this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
novicheck, 2016-07-11
@novicheck

Managed to manage on my own. It is necessary to insert "list" between print and bracket

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question