【发布时间】:2014-09-29 13:57:44
【问题描述】:
如果用户 ID 已经存在,我想从我的集合中返回 true,否则返回 false。我有这个函数,但它总是返回 True。
def alreadyExists(newID):
if db.mycollection.find({'UserIDS': { "$in": newID}}):
return True
else:
return False
如果用户 id 已经存在,我怎样才能让这个函数只返回 true?
【问题讨论】:
标签: python mongodb pymongo tornado-motor