Open keyleo opened 4 years ago
it is a bug. you can modify this file src/cursor.lua in line 42:
function cursor_methods:limit(n) assert(n) self.limit_n = n return limit end
modify
return limit
to
return self
then use like this
r:sort({["timestamp"]=-1}):limit(100)
Let us say, we have 1000 records, and I want to fetch latest 100 records by timestamp.
when i use local r = col:find(criteria,nil,100) r:sort({["timestamp"]=-1})
the cursor return sorted result of first 100 results.
what I want is sort 1000 records first, and then limit 100 records.