I'm using bookshelf plugin of node JS to execute mysql query. But i don't know how to execute LIMIT query. Like that
SELECT * from tableName LIMIT 2;
My connection bookshelf:
Bookshelf.mysqlAuth = Bookshelf.initialize({
client: client,
connection: {
host : host,
user : user,
password : password,
database : database
}
and the data method:
bookshelf.Img = Bookshelf.Model.extend({
tableName: 'image'
});
You can use this when calling for connection:
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(){});
I've tried with
qb.limit(5).then(function(){});
but it fired an error
Possibly unhandled TypeError: Cannot call method 'apply' of undefined
Please suggest any solutions for that. Thank you!