Skip to content

Commit

Permalink
Fixed bugs in cursors, update version
Browse files Browse the repository at this point in the history
  • Loading branch information
DorianGray committed Nov 20, 2014
1 parent a343b15 commit 2fd4f65
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package = "resty-mongol"
version = "0.8-2"
version = "0.8-3"
source = {
url = "https://github.com/Olivine-Labs/resty-mongol/archive/v0.8.tar.gz",
dir = "resty-mongol-0.8"
Expand Down
4 changes: 2 additions & 2 deletions src/colmt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ local function full_collection_name ( self , collection )
end

local function docmd ( conn , opcode , message , reponseTo )
local req_id = math.random(1, 4294967295)
local req_id = math.random(1, 2147483647)
local requestID = num_to_le_uint ( req_id )
reponseTo = reponseTo or "\255\255\255\255"
opcode = num_to_le_uint ( assert ( opcodes [ opcode ] ) )
Expand Down Expand Up @@ -308,7 +308,7 @@ function colmethods:insert(docs, continue_on_error, safe)
end
local r, err = self.db_obj:cmd(attachpairs_start({
count = self.col,
query = next(query) and query or nil
query = query and next(query) or nil
}, "count"))
pairs = oldpairs
if not r then
Expand Down
5 changes: 3 additions & 2 deletions src/cursor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ function cursor_methods:next()

local t
if not self.id then
self.id, self.results, t = self.col:query(self.query,
self.id, self.results, t = self.col:query(self.query,
self.returnfields, self.i, self.num_each)
if self.id == "\0\0\0\0\0\0\0\0" then
self.done = true
end
else
self.id, self.results, t = self.col:getmore(self.id,
self.id, self.results, t = self.col:getmore(self.id,
self.num_each, self.i)
self.skip_n = self.i
if self.id == "\0\0\0\0\0\0\0\0" then
self.done = true
elseif t.CursorNotFound then
Expand Down

0 comments on commit 2fd4f65

Please sign in to comment.