Questions tagged [sails-mongo]

MongoDB adapter for Sails.js

Sails-mongo allows connecting to from using the ORM api.

400 questions
0
votes
2 answers

sails mongo retrieve selected column

I am using sails-mongo adapter for my sails project. I want to retrieve selected column from collection. Here is my collection document data { "_id": ObjectId("54449e2ecaf08cf40fc8704f"), "name": "demo", "display_name": "demo", …
Nishchit
  • 18,284
  • 12
  • 54
  • 81
0
votes
5 answers

How can I sort data in descending order using sails-js?

I want my data sort by "createdAt" column . Sometime in ascending order and also descending order also. I am using mongo db . Currently, I have created app which have feature like Users data can be sorted by admin request. Admin can view data in…
Bhushankumar Lilapara
  • 780
  • 1
  • 13
  • 26
0
votes
1 answer

Can I use the sails's query modifier "contains" with a collection of objects?

I'm trying to obtain all objects that have an especific object in a collection. Example: Object Company has a collection of Employees, and I want to find all Companies who have a especific Employee on this collection. What I'm trying to do…
Sidney
  • 141
  • 5
0
votes
2 answers

change database to mongo db on sails.js

I am a newbie in sails.js framework(and for node.js) and I have created myself an API from the address bar using sails.js features. my question is how do I transfer this data to mongodb so I can see it visually. I have tried to follow this guide:…
Matan Gubkin
  • 3,019
  • 6
  • 25
  • 44
0
votes
1 answer

Sails.js - Many-to-Many fails to save

I have a simple need to add tags to patients. I followed the Sails and Waterline documentation concerning many-to-many associations, but it's failing at some point (no errors). I'm using MongoDB for data storage. Code below: Tag Model module.exports…
Matt Shultz
  • 312
  • 3
  • 10
0
votes
1 answer

sails.js join tables on mongodb native id

I have two collections in mongodb database and model for each of them App Model module.exports = { tableName: 'app', attributes: { _id : { primaryKey: true, unique: true, type: 'string', …
styopdev
  • 2,604
  • 4
  • 34
  • 55
0
votes
1 answer

How-to manual add unique for all table in mongodb?

I use sails-mongo for working with models, I have a few attr with unique: true, but recently, this option does not work in the bug tracker said that it is necessary to add yourself this unique option, and then run using the migrate: safe. But I do…
0
votes
1 answer

Sailsjs Mutated attributes

I would like to be able to track the mutated (modified) attributes of an object in sails during afterUpdate lifecycle callback. Assuming an object is updated I would like to know which attribute has been modified during the update operation, I've…
Adraen
  • 25
  • 3
0
votes
1 answer

Why does Sails v.0.10.x respond to POST to nested route with one-to-many association?

In my app, I have two models Person and Room. I also have two controllers, PersonController and RoomController. I have added no custom routes, and I've overridden none of the boilerplate controller actions. When I POST to, for example,…
kevinsapp
  • 374
  • 5
  • 11
0
votes
1 answer

Is there a way i can create a collection at runtime in SailsJs?

What I've understood, sails binds collection with its Models. Is there a way i can create a collection on runtime. What i want to do is create a different collection for each user. something like (user_12345, unique for every user). I've tried…
northdakota
  • 3
  • 1
  • 5
0
votes
2 answers

mongo $in query isn't working with sails.js find method

var arr=[18,5,6,....]; Beneficiary.find({Ward: { $in: arr } }).done(function(err,ben) { if(err) console.log(err); else { console.log(ben); } }); I…
user3736968
  • 85
  • 2
  • 5
0
votes
2 answers

Jasmine-node and sails.js (0.10.0-rc8)

When I try to run something as simple as this, I get an error: 'static() root path required'. If only one 'it' is run, it will pass. Anyone knows what's the catch? var Sails = require('sails'); describe("Crud tests:", function() { var app; …
gazdac
  • 189
  • 2
  • 11
0
votes
2 answers

As I can use different models in the same controller action

I'm trying to send to the view, information from multiple models as follows: var tareasGlob = ""; var directoresProy = ""; var usuariosGlob = ""; var proyectosGlob = ""; module.exports = { 'index' : function(req, res, next){ // De esta…
Cristian G
  • 779
  • 2
  • 10
  • 21
0
votes
1 answer

Handling async database in nodejs

I'm new in node js. I'm using sails js as framework. I'm trying to use nested database query. Please check the added code. My current mongo collection name is todostatus. Form it i grabbed the data . Then I tried to use a callback function to…
nixon1333
  • 531
  • 1
  • 9
  • 23
0
votes
1 answer

Query embedded collection in a sails project with mongodb

I'm using sails-mongo in my project and i need to execute one query in an embedded collection. My data are something like the following: { "_id" : ObjectId("53906c6254f36df504e99b8f"), "title" : "my post" "comments" : [ { …
Victor
  • 5,043
  • 3
  • 41
  • 55
1 2 3
26
27