Update model value in boot script by id in loopback?

19 views
Skip to first unread message

sparsh...@gyrix.co

unread,
Oct 3, 2015, 5:39:02 AM10/3/15
to LoopbackJS
I'm using this code in one of my server boot script-

var server = require('../server');
var ds = server.dataSources.mysql;

var express = require('express');
var request = require('request');
var router  = express.Router();

module.exports = function(app) {

app.get('/test',function(req,res){
    //console.log(server.model);
    server.models.Company.update({
        filter: {
            where: {
                id: 1
                },
            },
        },
        name: 's12'
    });
});
};

the problem is it updates all row in the database. How should I make this function so that it updates name where id is 1.

please help me into this.



Reply all
Reply to author
Forward
0 new messages