Questions tagged [sails-mongo]

MongoDB adapter for Sails.js

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

400 questions
0
votes
1 answer

How to securize an entitie on Sails?

I'm developing an API with Sails, and now I need to securize some variables from an entity. Those variable will be accesed only from Admin or own user. I have an structure like this: Employee (contains your employee…
Víctor Martín
  • 3,352
  • 7
  • 48
  • 94
0
votes
1 answer

Remove an array value from mongodb collection document, sailsjs

I have an array like this on under user collection How can i remove a single value from this array by using sails.js code also i need to remove all post id from every users document if a post is deleted, is there any simplest and fastest way to…
BINFAS K
  • 246
  • 3
  • 11
0
votes
1 answer

.save() doesn't work on Sails

I want to broadcast a notification to all users in one of my services, notifications are array attribute of user model. so I should push object of new notification to every user notification array in database. here is my code: broadcastNotif :…
0
votes
1 answer

Sails.js/Waterline: is it possible to perform a "silent" update (without affecting updatedAt field)?

So I want to update my model without changing updatedAt field (not by default). Does Waterline have such a feature at this moment?
Kiryl Anokhin
  • 429
  • 4
  • 10
0
votes
1 answer

files not uploading sails js

So, when I upload file it doesn't me show any error, it just doesn't upload the file and I get the message '0 files uploaded successfully, I do get the record in database for each uploaded item So, here's the input form
Bro
  • 1
0
votes
3 answers

How to update a model with Sails JS

Ok, I've got the following in one of my controllers: User.find({email: 'email@example.com'}).then(function (user) { user[0].field = 'new_value'; user[0].field_2 = 'new_value'; console.log(user[0], 'before saving'); user[0].save(); …
WagnerMatosUK
  • 4,309
  • 7
  • 56
  • 95
0
votes
2 answers

Sails Framework + MongoDB set connection pool size

We are using sails framework for our web application and MongoDB as database. Now we are calling services of the web app from the mobile. There can be around 200-300 concurrent users calling webservice. I observed that there are around 5-6 services…
user3759750
  • 123
  • 3
  • 10
0
votes
1 answer

How can I wrap sails-mongo db methods for profiling?

I'm trying to setup a sails hook with miniprofiler to help profile mongo usage. I'm struggling for how to wrap the db methods in a function that will execute the profile. I'm trying to do this via a user hook: setupMiniprofilerMongo(req, res, next)…
Jim Geurts
  • 20,189
  • 23
  • 95
  • 116
0
votes
1 answer

Bluebird Promises in waterline .native() sailsjs with sails-mongo

According to the .native() documentation, the way to use .native() query for sails-mongo is : Pet.native(function(err, collection) { if (err) return res.serverError(err); collection.find({}, { name: true }).toArray(function (err,…
jgr0
  • 697
  • 2
  • 6
  • 20
0
votes
1 answer

How to catch MongoDB errors in Sails

hopefully someone can help me. I'm using sails and sails-mongo to connect to my Mongo DB replicaSet. This is all done via config in Sails, so I do not actually create the connection using the MongoDB driver myself, Sails and the ORM (Waterline) take…
dandanknight
  • 659
  • 5
  • 21
0
votes
1 answer

Sails.js - How to do a native query on a model that have an attribute of array type?

I build a web app using sails.js and my database is mongo. This is my model - Conversation: module.exports = { tableName: 'conversations', attributes: { members: { type: 'array', collection: 'user' }, status: { …
Dror007
  • 13
  • 5
0
votes
1 answer

Code outside in for loop executing before execution in node.js

here is my code snippet. I am trying to get details of my friends.friendsList is in reside within the user collection itself and there i am inserting users's id. So first i am fetching userId,then fetching each of their details.but my problem is i…
John Mathew
  • 41
  • 12
0
votes
2 answers

Call back issue in forloop in node js

here is my code snippet. I am trying to get details of my friends.friendsList is in reside within the user collection itself and there i am inserting users's id. So first i am fetching userId,then fetching each of their details.but my problem is i…
Ritz
  • 394
  • 1
  • 3
  • 12
0
votes
1 answer

Unable to update boolean value in sailsjs waterline

I'm working on a project that is built on top of SailsJS but now i'm writing the Update process for a document and when i'm doing this, getting the following error. { "code": "E_VALIDATION", "invalidAttributes": { "deleted": [ …
Talib Allauddin
  • 123
  • 3
  • 16
0
votes
1 answer

can we create two model or controller for same collection in sails js

I am new to sails js. I am using mongodb database. I have users collection. I have created api using sails generate api users it creates Users.js and UsersController.js files. I want to know that can we create another controller or model for the…
Tejashri Bedarkar
  • 149
  • 1
  • 2
  • 10