node-orm2 icon indicating copy to clipboard operation
node-orm2 copied to clipboard

Offset and limit not work on mysql

Open JayceLin opened this issue 9 years ago • 3 comments

JayceLin avatar Dec 14 '15 09:12 JayceLin

Maybe something mistake I make. When I used "model.find(condition).offset(0).limit(20)" or “model.find(condition,{offset:0,limit:20})”, they didn't work. Then I change to db.execQuery to run the native sql, and it works.

JayceLin avatar Dec 15 '15 02:12 JayceLin

JayceLin shouldn't it be: model.find(condition).limit(20).offset(0)? Offset is an addition on the limit functionality. Mysql query should be looking like this: SELECT * FROM [table] LIMIT 10 OFFSET 5; and not: SELECT * FROM [table] OFFSET 5 LIMIT 10;

Hope it works

lvanbuiten avatar Dec 21 '15 23:12 lvanbuiten