Questions tagged [sails-mongo]

MongoDB adapter for Sails.js

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

400 questions
1
vote
1 answer

Combined search in sails js

I have game collection: { "name": "Play RoadRash", "version": "1.0.0", "icon": "image-md-two-thirds.png", "id": "6dc41c3fa0e7" } and platform collection: { "name": "PlayStation", "version": "7", "icon": "playstation.jpg", "id":…
rash111
  • 1,307
  • 4
  • 19
  • 35
1
vote
1 answer

Not all model values updating using .update() method

I have sails js 0.11v and mongodb, when i use .update function of sails js, Except enum attrribute every other value is updating. Here is my model module.exports = { schema: true, attributes: { name: { type: 'string', …
rash111
  • 1,307
  • 4
  • 19
  • 35
1
vote
1 answer

nodejs mongodb connect/disconnect pattern

I'm using sails.js with mongodb for my backend. And I've heard that connecting to database for each request can be really expensive, that's why other non-single threaded programming languages hold a connection pool for database right? So I wonder…
dulan
  • 1,584
  • 6
  • 22
  • 50
1
vote
1 answer

Fields that are a relationships dont be appeared by callback create in SailsJS

I have the following Media schema module.exports = { attributes: { user: { model: 'user', required: true }, jobs: { collection: 'job', …
1
vote
1 answer

Association populate returns results even if an association is empty

I'm struggling upon a problem related to Sails.js and Waterline associations. The database technology is mongoDB and I'm using the sails-mongo adapter. I have a model User which has an association with a Role model. The association is of…
mastergap
  • 375
  • 1
  • 3
  • 10
1
vote
1 answer

How to set order by created date in mongodb query using sails js

I am little familiar with sails and mongoDB, Here i want to know how to sort the data while selecting from collection in DESC order. Here i enclosed my controller function: listall : function(req, res){ var userId =…
Rahul Saxena
  • 465
  • 4
  • 15
1
vote
1 answer

How to have an optional association using Waterline?

I'm using sails.js for a project and everything is going fine so far. Except that I don't know how to have an optional association between my two models. If I don't specify one, then if I use populate() it takes the first one available. I have those…
Julien Fouilhé
  • 2,583
  • 3
  • 30
  • 56
1
vote
2 answers

how to get record from multiple collection in sails.js

I am newbie in sails.js , I am trying to create crud and login using sails js. I want to fetch record of loggedin user from multiple collection like user profile details and post done by login user. I dont know how to query from multiple collection…
Rahul Saxena
  • 465
  • 4
  • 15
1
vote
1 answer

Sails.js: Nested MongoDB queries

I am using Sails v0.11 and am developing an standalone importer script in order to import data to mongoDB and - that is now the not-working part - build the associations between the models. For this process I introduced temporary helper properties…
Manuel Reil
  • 508
  • 2
  • 10
1
vote
1 answer

getting issue in update query in sails js

I am new in sails js and getting some issue my update query show updated successfully but it does not update the record in mongodb collection. I don't where i am doing silly mistake. Here is controller function edit: function(req, res){ var uid…
Rahul Saxena
  • 465
  • 4
  • 15
1
vote
1 answer

Mongo Error while removing record using sails js

I am new in sails.js , trying to create crud using mongodb and sails.js , Getting some issue while delete a record from the list of record. Here i attach my all working file , Please guide me // controller file function removePost: function(req,…
Rahul Saxena
  • 465
  • 4
  • 15
1
vote
1 answer

How to Looping inside Model.find Sailsjs

Good day all, can someone suggest me which async function should i use?, in my case, I need an output the 1st member of each group. *** note this is just a example of the flow of my program. /* Grouplist groupmember Id |…
zxcetera
  • 115
  • 2
  • 14
1
vote
2 answers

sails.models.['CollectionName'] is not working in latest Sails Version

I am trying to access Model component via sails.models.['CollectionName'] as these CollectionName will be dynamically sent into this piece of functionality. But it is throwing undefined error. /sails12.rc3/myapps/api/services/UserService.js:86 …
Raj Rajen
  • 203
  • 2
  • 17
1
vote
1 answer

Sails:[TypeError: Cannot read property 'userId' of undefined]

I'm trying to create google and facebook OpenId Authentication using passport.js. When i trying to login via google and facebook but it showing [TypeError: Cannot read property 'userId' of undefined] please resolve this error. Here i attached my…
Martin
  • 237
  • 2
  • 11
1
vote
0 answers

Updating multiple records at once by appending objects to a collection found in each record, in Sails JS

I'm trying to use .native() to update multiple records. Here's my code: // Controller Pet.native(function(err, collection) { // For demo purposes only. Correct owner is returned previously from Owner.findOne() var owner = { id:…
coder9
  • 1,571
  • 1
  • 27
  • 52