mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-23 19:43:09 +00:00
bugfix: lua mongo result
This commit is contained in:
@@ -167,7 +167,9 @@ function mongo_db:runCommand(cmd,cmd_v,...)
|
||||
bson_cmd = bson_encode_order(cmd,cmd_v,...)
|
||||
end
|
||||
local pack = driver.query(request_id, 0, self.__cmd, 0, 1, bson_cmd)
|
||||
local doc = sock:request(pack, request_id).document
|
||||
-- we must hold req (req.data), because req.document is a lightuserdata, it's a pointer to the string (req.data)
|
||||
local req = sock:request(pack, request_id)
|
||||
local doc = req.document
|
||||
return bson_decode(doc)
|
||||
end
|
||||
|
||||
@@ -224,7 +226,9 @@ function mongo_collection:findOne(query, selector)
|
||||
local request_id = conn:genId()
|
||||
local sock = conn.__sock
|
||||
local pack = driver.query(request_id, 0, self.full_name, 0, 1, query and bson_encode(query) or empty_bson, selector and bson_encode(selector))
|
||||
local doc = sock:request(pack, request_id).document
|
||||
-- we must hold req (req.data), because req.document is a lightuserdata, it's a pointer to the string (req.data)
|
||||
local req = sock:request(pack, request_id)
|
||||
local doc = req.document
|
||||
return bson_decode(doc)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user