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 sort records using object's key in sails js

Hello friends I am writing the web service using sails js. I am fetching all posts and getting the following response : [ { id: "559458c51ccc9c716dabf666", comments : [], liked : { data : [ { id:…
Tejashri Bedarkar
  • 149
  • 1
  • 2
  • 10
0
votes
2 answers

How to prohibit access to the API for non authorized users?

I'm using sails.js and I can use API to modify data in mongodb, for example create new user, modify users etc. How to prohibit access to the API for non authorized users?
mgicrush
  • 53
  • 1
  • 1
  • 6
0
votes
1 answer

Sails.js Waterline sails-mongo findOne

I'm using Waterline in my Sails.js app, with the sails-mongo adapter. I'm trying to get a record from my MongoDB searching by _id. This is what I've tried: Case.findOne({id: args.itemId}).exec(function(err, retObj) {...} Case.findOne({_id:…
pjlamb12
  • 2,300
  • 2
  • 32
  • 64
0
votes
1 answer

Slow MongoDB queries with Sails.js

I wrote an app using Sails.js with mongoDb(sails-mongo). Firstly, I decided to write all to a single document... And database slowed on 5GB of data.. "Slowed" means that basic find query executed in 30-50s.. Than I rewrite all in an multiple…
0
votes
1 answer

References(foreign key) in sailsjs

I have two models in sails 1. User_type 2. User User_type Model: module.exports = { schema: true, connection: 'mongo', attributes: { user_type: { type: 'string', required: true, enum: ['superadmin', 'admin', 'follower'] }, toJSON()…
0
votes
2 answers

Correctly using SailsJs policies, services and models

I'm new to NodeJs and SailsJs so be nice. I've been using policies to complete a POST request which will eventually create a new model; Policy to check that all request parameters are present, if any are missing then respond with 404 or similar…
Jake N
  • 10,535
  • 11
  • 66
  • 112
0
votes
1 answer

How can I get data into a Sails.js app from a MongoDB?

I have a Sails.js app that needs to fetch from a Mongo database, then display that data in a graph. Alternately, it can take data from a JSON file located on the server. I am struggling with that process immensely. What seems like it should be an…
Kickasstimus
  • 197
  • 15
0
votes
0 answers

Sails Js model atrributes set in array subdocument

I am trying to add attribute date in sails model sub document.But giving error. {type:'array',model:'Recommendations'} Recommendations.js var Recommendations = { attributes: { role : {type:'string'}, user : {type:'string'}, userName :…
Kundan Sharma
  • 189
  • 1
  • 8
0
votes
0 answers

POST and GET image using SAILJS does not work (error: [object, Object]) While uploading Image

This is my code which is referred to sails documentation I want to upload an image for file controller action and get it upload and store it through user controller action upload and get. It is not working its show an error: [object, Object]. file…
0
votes
1 answer

How to store an array of nested objects using Sails.js with MongoDB?

I'm trying to save an nested object inside a sails.js model. This is how it looks like: module.exports = { schema: true, attributes: { label: { type: 'string', required: true, }, consumption: [{ …
Alexandre Justino
  • 1,716
  • 1
  • 19
  • 28
0
votes
1 answer

Is there a standard way to expand associations with Sails, Mongo and Waterline with .findOne()?

My models contain associations to other models which are obviously just stored with their ObjectId. What I want to know is if there is a way to pass in the option to expand either all associations or a particular set of associations. So 'item model'…
Tomas
  • 3,054
  • 5
  • 27
  • 39
0
votes
2 answers

Whenever i restart sails server session got expired how to save session in database?

from past two days i am facing this problem. whenever i restart my sails server session got expired and all users got logged out. Is there any way to overcome from this ? I have gone through the sails doc but not successful to save the session in…
Ankur
  • 51
  • 4
0
votes
1 answer

How to implement many to many association using through in Sails?

I'm using Sails v0.11.2 and MongoDB 3.2 on Mac OS X El Capitan and I'm trying to implement Many-To-Many association using Through option which isn't supported yet. However, googling I found this Waterline Github Issue and elennaro, a github user,…
alexventuraio
  • 8,126
  • 2
  • 30
  • 35
0
votes
1 answer

How to do query with dynamic numbers of condition with SailsJS and MongoDB

I'm using SailsJS with MongoDB. For the Model "accounts" I'm using below code: attributes: { campaignID : { type: 'string' }, cell : { type: 'string' }, firstname : { type: 'string' }, lastname : { type: 'string' }, ssn : {…
Charlie Zeng
  • 131
  • 1
  • 3
  • 17
0
votes
2 answers

Is there a bettery way to work with nested(associated) models in Sails JS?

I've connected my SailsJs app to a Mongodb database. I'm working on an analytic application. These are the major models in my application: User Project Report Event A user can have many projects, a project can have many reports and a report can…
Iman Mohamadi
  • 6,552
  • 3
  • 34
  • 33