Questions tagged [sails-mongo]

MongoDB adapter for Sails.js

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

400 questions
2
votes
1 answer

SailsJS - Associated records vs Embedded Collection

I'm using SailsJS / Waterline ORM with a Mongo DB. It's a realtime application so the sails sockets.io pub/sub is used heavily. I have a few instances in my application which require many-to-many and many-to-one associations. I'm fairly sure I can…
mcnamee
  • 508
  • 1
  • 5
  • 11
2
votes
0 answers

Sails/Waterline populate does not work in junction table?

Waterline populate gives me an empty collection when I try to populate a junction table (model) with another junction table (model). I'm using many-to-many through relationship as given…
2
votes
0 answers

Why wouldn't a waterline callback happen to be triggered?

I'm using Sails built in models and it's ORM to perform MongoDB queries and operations. The problem I got is that, for some query methods,it's callback is never being called. The DB operation gets done, but callback won't come up. Following code…
diegoaguilar
  • 8,179
  • 14
  • 80
  • 129
2
votes
1 answer

How to find specified fields in mongodb in sails?

In mysql, I can retrieve specified columns by using: User.find({select:['email']})..... Now I am moving to mongodb, I tried: User.find({select:['email']})..... User.find({},{email:1})..... User.find({},{fields: {email:1}}).... But none of them…
Michael
  • 402
  • 1
  • 3
  • 16
2
votes
1 answer

Sails shows no error when model validation fails

in my production environment that uses MongoDB, whenever a model validation fails it shows nothing, while on my development environment with no database it shows something like this: { "error": "E_VALIDATION", "status": 400, "summary": "10…
Kevin
  • 611
  • 3
  • 9
  • 14
2
votes
3 answers

Sails 0.11 & Sails-Mongo 0.11.2 unique constraint not working

I'm using sails 0.11 and sails-mongo 0.11.2 adapter. I have a user model with a nickname, and I want the nickname to be unique among every user. I specify the attribute as unique like this: nickname: { type: 'string', unique: true } It is not…
Luis Crespo
  • 1,610
  • 1
  • 20
  • 33
2
votes
1 answer

Waterline MongoDb (populated) fetched object looses its type AND prototype functions

I'm using sails with mongo db over waterline. Lets say that I declare 2 models in my sails project like so : A user model @ models/User.js simplified: username: { type: 'string', unique: true }, passports: { collection:…
SudoPlz
  • 20,996
  • 12
  • 82
  • 123
2
votes
1 answer

How can i get the full related model in view in sails.js?

I've created a sails.js application. I'm trying to get full related model Creator in view but I get only id... How can I do this? I'm doing this: Model Author.js module.exports = { attributes: { name: { type:…
derzunov
  • 452
  • 4
  • 13
2
votes
1 answer

sails.js not lifting after data migration

I use sails.js with MongoDB as primary place for my models. I've just completed data migration from production DB, and now there are several hundred thousands documents in some collections. But there is a problem. When I try to sails lift i'm…
Radagast
  • 5,798
  • 3
  • 22
  • 18
2
votes
4 answers

sailsjs still uses default database after changing it to mongodb

I am new to sailsjs and currently working on project that uses sailsjs. I want to change the default database to mongodb. I did it in config/local.js like following connections: { 'defaults': 'mongo', mongo: { module: 'sails-mongo', …
Om3ga
  • 30,465
  • 43
  • 141
  • 221
2
votes
1 answer

Waterline query where clause with 2 "or" clauses

I am trying to write a sails waterline query with two 'or' clauses where both have to be true, but it seems to not work. This is the query that I have tried but it pulls only when one of the 'or' clauses meets its criteria, which I am trying to…
jerry
  • 141
  • 2
  • 4
2
votes
1 answer

Sails.js save multiple associations

I'm building a very simple API with sails which handles participants and teams . Teams might have several participants, so the API should accept multiple participants IDs to create the relationships when creating a new team. Participant…
kevinblanco
  • 779
  • 2
  • 7
  • 13
2
votes
0 answers

How can I select different databases for a model based on request parameters in Sails.js?

I have an application that I am considering porting to Sails.JS. One of the big issues I am having is supporting the per-request database selection that we have right now. Our app creates/uses a different database for each customer that we have and…
Dema
  • 6,867
  • 11
  • 40
  • 48
2
votes
1 answer

How to do Character wise Search with mongoDB Collection inside model in sails.js

I am newbie to sails and node.js. I am creating a Forum and want to add search function in order to search threads that match with User Search input. My search function need to character wise match the user entered characters with database thread's…
Anuradha
  • 53
  • 5
2
votes
1 answer

How to send final response from findOne() callback?

I have a User controller that has a create method that checks the database for email and username uniqueness before creating the user (this is to work-around a bug in the mongodb adpater for SailsJS that doesn't honour the unique attribute flag -…
onblur
  • 365
  • 1
  • 5
  • 16