Questions tagged [sails-mongo]

MongoDB adapter for Sails.js

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

400 questions
3
votes
1 answer

Sails.js + MongoDB when lifting often throw error "`orm` is taking too long to load"

Why the error `Error: The hook 'orm' is taking too long to load.` It occurs very often when sails is lifting? Even orm timeout already set to 100000, it still occur sometimes (not always). Usually it happen after PC has been restarted and sails…
Andi N. Dirgantara
  • 2,050
  • 13
  • 20
3
votes
1 answer

SailsJS (0.11.0 as well 0.12-rc3) : Selecting Parent Data from Child ID in 1 - M relationship

Selection of Parent with one of the Child isn't working in Sails JS. Rather, my select statement's aren't yielding result. So, looking for best answer Model 1: User module.exports = { attributes: { name:{ type:"string", …
Raj Rajen
  • 203
  • 2
  • 17
3
votes
2 answers

Adding duplicates to SailsJS model with many-to-many association

I have two models, items and order, that have a many-to-many association. What I've been trying to do for the past 5 hours is figure out a way to add multiple items objects to an order including duplicates. If the items are unique it works…
Sunny Patel
  • 578
  • 6
  • 9
3
votes
1 answer

How to overwrite object Id's in Mongo db while creating an App in Sails

I am new to Sails and Mongo Db. Currently I am trying to implement a CRUD Function using Sails where I want to save user details in Mongo db.In the model I have the following attributes "id":{ type:'Integer', min:100, …
shubhamagiwal92
  • 1,362
  • 4
  • 25
  • 47
3
votes
1 answer

sails-mongo adapter, normalize error messages

I am trying out sailsJs with mongodb using the sails-mongo adapter. After adding validations to a model, I get the following response when the validation fails. Users.js Model: module.exports = { schema: true, attributes: { name: { …
hussainb
  • 1,218
  • 2
  • 15
  • 33
3
votes
2 answers

How to use Array attributes in sails.js model

Hi i am a new bee to sails and trying to get a model api that finally gives output as follows [ { "icon" : [ {"name":"ico1", "ico_typ":"fb", "ico_content_URL":"someLocation"}, {"name":"ico2", "ico_typ":"tw",…
Anandapriyan S.D
  • 315
  • 4
  • 15
3
votes
1 answer

SailsJS: Setting autoPK:false still generates mongodb's id attribute

Using SailsJS, I'm trying to figure out how to use a custom Primary Key as Integer that auto increments. For that, I passed autoPK:false, but I see that mongo still used it's 'id' field with UUID, as if Waterline is ignoring my autoPK entry. For…
Alon Amir
  • 4,913
  • 9
  • 47
  • 86
3
votes
1 answer

How Do I Store Nested Object Array in Sails.js Model?

Long story short I'm creating a User model that needs to be able to have expiring subscriptions, and was wondering how to store them correctly using Sails. The kind of model I need is: User : { ... subscriptions : [{ artist :…
Charlie
  • 81
  • 1
  • 4
3
votes
1 answer

How to perform a sorting with case insensitive in the sails js framework?

model.find({city: city, sort: 'cityname ASC'}, function(err, cityList){}); the above code giving the correct sorting list but whenever the city is in both uppercase or lowercase like Coimbatore,bangalore,Chennai it gives the output as…
3
votes
1 answer

how to make a recursive relationship in sails?

Diagram: I want to have a array with all IDs of the friend users, like this: { id: 1 name: 'Javi', email: '123@gmail.com', friends: [2] } { id: 2, name: 'User2', email: '321@gmail.com', friends: [1] } i tried with…
GNUrub
  • 106
  • 5
3
votes
1 answer

TypeError: Cannot read property 'id' of undefined - sails and mongodb

Sails@beta, mongodb, windows 7 32bit, i am receiving the above error after trying to make a new user through the app. when i remove the policy isPawn from config/policies.js everything works. i don't understand what is wrong with this policy. it…
mrcni
  • 509
  • 1
  • 5
  • 12
3
votes
1 answer

How to extract distinct values from a mongo database using Waterline and Sails.js (version 0.10)?

Using Sails.js version 0.10.x, assume I have a model Dog, populated as follows (writtenout in yaml format for convenience, but in my case it's actually in a mongo database.) dogs: - breed: "wolf" name: "Fido" - breed: "wolf" name: "Roger" - …
Dave Sag
  • 13,266
  • 14
  • 86
  • 134
3
votes
2 answers

database migrations with sails and mongodb

I have a sails app(v ~0.10.0) using sails-mongo (v 0.10.0-rc4) and i need to execute some queries in my database through migrations. There is any support to this feature in sails?
Victor
  • 5,043
  • 3
  • 41
  • 55
2
votes
1 answer

I'm using "sails": "~1.2.4". I'm trying to connect to a MongoDb. But When I try to sails lift I get this error:

**Error Type** error: A hook (`orm`) failed to load! error: Could not tear down the ORM hook. Error details: Error: Consistency violation: Attempting to tear down a datastore (`default`) which is not currently registered with this adapter. This is…
Abir
  • 41
  • 3
2
votes
0 answers

Is there a way to dynamically add attributes to initialized Models in Sails.js at runtime?

I have a challenge from a customer. They'd like me to be able to support the creation, editing and deletion of custom fields against a Model within my application. This is so they can record any values that they see fit against a model and report…
MattGarnett
  • 545
  • 3
  • 20