Versuchen Sie es mit str(); Id = str(raw_input("enter id")) cursor = db.collection_name.find({"id" : Id})