Questions tagged [sails-mongo]

MongoDB adapter for Sails.js

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

396 questions
13
votes
1 answer

Using Waterline model outside SailsJS api

Is it possible to use models defined within [app-name]/api/models outside api folder? I have created separate folder in application root, where I placed cron job that should fill my database every hour. I would like to reuse Models defined inside…
Ned
  • 3,261
  • 6
  • 26
  • 48
10
votes
1 answer

How to perform a bulk insert via sails-mongo and sails.js?

Is there a way to perform a bulk insert via sails-mongo. So if I pass an array of documents to the model's create method, it will insert each document within that array atomically into the database?
ses
  • 158
  • 1
  • 7
9
votes
2 answers

how to set default value for a field in Sails models using Waterline ORM?

A very simple question but I am unable to find the answer to it. So in my Sails app I have a User model and I am trying to make a boolean field with a default value to be False. Is there a way to specify defaults like some kind of default attribute…
Gagandeep Singh
  • 306
  • 1
  • 4
  • 7
8
votes
4 answers

Sails js - waterline ORM limit or sort after group by?

I am using Waterline ORM for sails.js. limit and sort are not working when you use groupby, but are working fine when you dont do any grouping . For example Model.find({ groupBy:['term'], sum:['count'], limit:20, sort :'count…
sanath_p
  • 2,006
  • 2
  • 22
  • 22
7
votes
4 answers

Implementing push notifications in sails js

I am new to sails js. I want to implement push notifications for both android and IOS in sails js . I am using Sails js with mongodb. can anyone help me with regarding configuration or which plugin to use to implement push notifications in sails…
Anil Kumar
  • 187
  • 9
7
votes
1 answer

Handling database environment configuration in Sails.js

The issue I have is related to the following quote from the official documentation: Note If any connection to an adapter is used by a model, then all connections to that adapter will be loaded on sails.lift, whether or not models are actually using…
Sebastian
  • 1,995
  • 1
  • 22
  • 40
6
votes
1 answer

How to properly instantiate a Waterline Model Object from a sails-mongo native result?

I am using SailsJS on a project and I need to use native() for certain querys. The problem I have is that I can't find a proper way to instantiate a Waterline Model Object from the mongo collection find result. I have being searching information…
6
votes
1 answer

Sails.js Model: create 2 association to self failed

I'm pretty new on Nodejs and sails. I'm implementing a server which is similiar to Twitter. In user model, there should be 2 fields: follower and following, and the 2 fields are association of the model 'user' itself. My question is when the model…
Renyuan wang
  • 171
  • 1
  • 8
6
votes
2 answers

error:a hook ('orm') failed to load when lifting sails app using mongo DB

I get this error: a hook ('orm') failed to load when trying to lift a sails app using mongoDB. This my connections.js file: module.exports.connections = { mongodb: { adapter : 'sails-mongo', host : 'localhost', port :…
Ebtessam Zoheir
  • 169
  • 1
  • 4
  • 13
5
votes
1 answer

Model Attribute Type: what is the difference between json and ref?

In the documentation regarding built-in data types, it is written: json: Any JSON-serializable value, including numbers, booleans, strings, arrays, dictionaries (plain JavaScript objects), and null. ref: Any JavaScript value except undefined.…
Julien Le Coupanec
  • 6,324
  • 3
  • 43
  • 56
5
votes
1 answer

node C:\Users\XXXXXXXX\AppData\Roaming\npm\node_modules\sails\bin\sails.js module.js:473 throw err;

After I npm installed Sails.js on Windows 10, "sails" command is not recognized. Can someone give me a hint on what values to use in the PATH variable? As I understand it is Node.exe that runs the sails.js file. But if I try tunning "node sails.js"…
5
votes
3 answers

mongoDB Atlas ♥︎ Sailsjs (waterline sails-mongo adapter)

i just created a MongoDB Atlas account. I'm using sails with waterline sails-mongo adapter but I can't manage to connect via my app. Everything is up to date. I can connect to any other DB (localhost, digitalocean server, ...) I can also connect to…
nab.
  • 135
  • 2
  • 10
5
votes
1 answer

Sails JS - Waterline ORM - Query Date only, not Time

Looking to query against the date only anyone encountered this? Sample code: ////MODEL module.exports = { attributes: { date: { type: 'date', required: true } } }; …
pim
  • 10,145
  • 4
  • 59
  • 61
5
votes
0 answers

How to prevent MP3s from being downloaded?

I'm on project to construct an online music site at the final stage of delivery. The MP3 audio files are openly available to download via browser inspector (absolute paths to the audio files). How can I secure them from being downloaded, yet still…
Vinay
  • 315
  • 1
  • 9
5
votes
1 answer

Fetch distinct record based on values for that record with MongoDB

I have collection of restaurant record .Some of restaurant in this collection belongs to some group(chain type restaurant eg. KfC etc) while other doesn't has any group(Individual restaurant ,that doesn't belongs to any chain). example : Restaurant…
1
2 3
26 27