user3504250 user3504250 - 1 year ago 113
Python Question

TypeError: unsupported operand type(s) for +: 'Cursor' and 'Cursor'

I want to be able to store two collections in variable to be able to view and sort through them. However, I seem to be getting the error above.
My code is in python and look like this:

from pymongo import MongoClient

db = MongoClient('', 27017)['mean-dev']
cursor1 = db.Build_Progress.find()
cursor2 = db.build_lookup.find()
joincursors = cursor1+ cursor2

for document in cook:

Answer Source

You need to chain the two cursors like this:

from itertools import chain

for document in chain(cursor1, cursor2):
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download