2013-10-18 27 views
0

我使用的是pymongo瓶,和我有錯誤:PyMongo錯誤:無法轉換類型的值BSON

bson.errors.InvalidDocument

InvalidDocument: cannot convert value of type to bso

我對這個錯誤代碼是:

def get_question_with_id(id,question): 
     question = db.questions.find_one({'id': id}) 
     return question,id 

我搜索對於一個解決方案需要很多小時,但是我沒有找到解決這個問題的答案。 這是什麼錯誤?

+0

您是否找到了解決此問題的答案? – 2015-10-02 00:46:33

回答

0
from bson.objectid import ObjectId 

def get_question_with_id(id,question): 
     question = db.questions.find_one({'_id':ObjectId(id)}) 
     return question,id 
相關問題