这是我的架构:
"_id" : "tofla@darhoum.dz"
"modif" : 1
"prs" :
{
"pass" : "sdfdsf"
}
"reset" :
[
{
"code" : "1680"
"timr" : "AQQOAAMGCQMcBgodAAYYAgIMDAkLBAEeAAcNAAEG"
}
]
我想在同一行代码中执行很多操作
yield tornado.gen.Task(db.users.update, {"_id":email}, {"$set":{"prs.pass":password}}, {"$inc":{"modif":1}}, {"$pop":{"reset":1}})
我得到了这个错误:
assert isinstance(upsert, bool), "upsert must be an instance of bool"
AssertionError: upsert must be an instance of bool
但是当我将操作分成三个时它可以工作,
yield tornado.gen.Task(db.users.update, {"_id":email}, {"$set":{"prs.pass":password}})
yield tornado.gen.Task(db.users.update, {"_id":email}, {"$pop":{"reset":1}})
yield tornado.gen.Task(db.users.update, {"_id":email}, {"$inc":{"modif":1}})
我发现了这个,但认为它在异步调用中不是一回事,这是 mongodb 锁吗?
更新:试过这个并且工作:
yield [tornado.gen.Task(db.users.update, {"_id":email}, {"$set":{"prs.pass":password}}),
tornado.gen.Task(db.users.update, {"_id": email}, {"$pop":{"reset":1}}),
tornado.gen.Task(db.users.update, {"_id":email}, {"$inc":{"modif":1}})]
但是危险吗?