Consider the have the following collection:
db.collection.insert({id:1, value:1})
db.collection.insert({id:2, value:2})
db.collection.insert({id:3, value:3})
Now, I have a file which has a list of ids. I can read the file and store the id in a variable. How do I now query the collection to get the details of that particular id:
f=open("file.txt")
for line in f:
idTemp=line.strip()
db.collection.find_one({"id":idTemp}) #This does not work