我正在使用節點JS的書架插件來執行mysql查詢。但我不知道如何執行LIMIT查詢。這樣如何選擇LIMIT mysql與書架nodeJS
SELECT * from tableName LIMIT 2;
我的連接書架:
Bookshelf.mysqlAuth = Bookshelf.initialize({
client: client,
connection: {
host : host,
user : user,
password : password,
database : database
}
和數據的方法:
var qb = data.Img.query();
qb.where('img_md5', '=', imgMD5save).update({img_size: fileLength, img_local_url: folder, img_type: fileType, img_downloaded: 1}).then(function(){});
我:
bookshelf.Img = Bookshelf.Model.extend({
tableName: 'image'
});
您可以要求連接時使用此已經嘗試過
qb.limit(5).then(function(){});
,但它發射的錯誤
Possibly unhandled TypeError: Cannot call method 'apply' of undefined
請建議的任何解決方案。 謝謝!