I\'m new in Python and MongoDB and I am starting a new project with flask-python and MongoDB. When I try returning data using the aggregate() function, it gives
Since Pymongo 3.0, the .aggregate() method return a CommandCursor which doesn't implement the __getitem__() method. Instead I suggest you return the cursor object in your function/method or turn to result into a list like this: return list(Data)