hi experimenting python , mongodb tornado framework. having entry module user can insert data of students in academic , sports field. in mongodb terminal did search
db.student.find( { $or: [ { "academy": name }, { "sports": name } ] } ) but when try same python along motor driver end error.
my python command is
doc = yield db.student.find_one({ $or: [{"academy": name}, {"sports": name}]}) can guide me how can search or condition in python motor?
the or condition used check whether data of particular student entered in both fields or not.
you write, "i end error", difficult answer question if don't tell error is!
in particular case think know problem. in python, field names must quoted. proper syntax is:
doc = yield db.student.find_one({ "$or": [{"academy": name}, {"sports": name}]})
Comments
Post a Comment