Reputation: 43
I've an application with sails.js and mongodb.
The sails rest api works fine for create. It also works fine when I access it as "http://localhost:1337/student" but not working when finding a specific document with id "http://localhost:1337/student/54e57a98469768d40df7fb24".
The object id in db is stored as _id : ObjectId("54e57a9e469768d40df7fb25").
I also tried to update record in Controller but that also seems to be NOT working:
Student.update({id:Student.mongo.objectId(req.body.id)},{is_active:0}).exec(function(err, data){ ............ }); Any help will be appreciated.
Thanks.
Upvotes: 0
Views: 1110
Reputation: 113
I do notice your ids are different between your URL and the mongo paste, so make sure that is on. Also I'd recommend installing the postman packaged app in the google chrome store, its really nice for doing rest work. If you watch the sailscasts videos by nathanirl on YouTube you'll see some nice examples of what it can do.
Also make sure your blueprints.js in config file is setup with. Actions, shortcuts and rest set to true
Upvotes: 1