def update_user_data(username, updates):
"""
Update the data for the given user in the database,
with the given dict of updates
"""
req_data = bson.BSON.encode({
"key": key,
"database": "feedlark",
"collection": "user",
"data": {
"selector": {
"username": username,
},
"updates": updates,
},
})
update_rsp = gearman_client.submit_job('db-update', str(req_data))
result = bson.BSON(update_rsp.result).decode()
if result[u"status"] != u"ok":
log(2, "Error updating user data: " + str(result))
评论列表
文章目录