Questions tagged [waterline]

Waterline is an adapter-based ORM for Node. It is included with the Sails.js framework.

Waterline provides a uniform API for accessing stuff from different kinds of databases, protocols, and 3rd party APIs. That means you write the same code to get users, whether they live in MySQL, LDAP, MongoDB, or Facebook.

At the same time, Waterline aims to learn lessons and maintain the best features from both Rails' ActiveRecord and Grails' Hibernate ORMs.

Waterline uses the concept of an Adapter to translate a predefined set of methods into a query that can be understood by your data store. Adapters allow you to use various datastores such as MySQL, PostgreSQL, MongoDB, Redis, etc. and have a clear API for working with your model data.

It also allows an adapter to define it's own methods that don't necessarily fit into the CRUD methods defined by default in Waterline. If an adapter defines a custom method, Waterline will simply pass the function arguments down to the adapter.

Project GitHub


Related tags :

1230 questions
0
votes
1 answer

use Waterline as Standalone (no express)

Good Afternoon, I am new with node.js and I try to develope an only command app. For this app I need an ORM and I wish to use WATERLINE as standalone but not in express framework. I looked at the example and I succeed to see my different…
0
votes
1 answer

Update sails model without trigger lifecycle?

I know that model.save({ silent: true }, callback); is not supported. But anyone know how to update Sails model without trigger lifecycle event?? I have ask on github issue, but still no respond so far. Link is here
Pewh Gosh
  • 1,031
  • 1
  • 11
  • 29
0
votes
1 answer

How can I filter populated values in sails.js?

I have model User. To simplify my issue it has not attributes (except id that is produced by sails engine): module.exports = { } I have also model UserPost: module.exports = { attributes: { user: { required: true, …
Boris Zagoruiko
  • 12,705
  • 15
  • 47
  • 79
0
votes
3 answers

Database Query in Sailsjs / Waterline

Suppose I have the 'User' model which has an attribute 'age' which can be set or not. I have 3 users A, B and C: A: { age: 20 }, B: { age: 10 }, C: {} With Sails I want to select all users which have a minimum age of 15 and at the same time…
Vee6
  • 1,527
  • 3
  • 21
  • 40
0
votes
1 answer

Get Count of related records in sailsjs

I have an artist model that has a collection of songs. I am not populating the related songs in the blueprints config, but I would like to at least get a count back so I know how many songs are on each artist. Here is what my simple artist model…
matt
  • 103
  • 1
  • 7
0
votes
1 answer

'or' query with different data types in sails.js

Given routes GET /user/42 GET /user/dude where 42 is user id and dude is username. So, I want to have method in my controller that return user for both cases. Here it is: // api/controllers/UserController.js findOne: function(req, res) { …
Boris Zagoruiko
  • 12,705
  • 15
  • 47
  • 79
0
votes
1 answer

Using sails.js models outside of sails

I'm trying to use my Sails.js models outside of the sails context. I have one simple model called "Request", and I'm using the sails-disk adapter. Everything works fine inside the Sails app, but when I try and use the model outside the app (I'm…
Marc
  • 3,812
  • 8
  • 37
  • 61
0
votes
1 answer

Breeze Json uriBuilder

I'm trying to use breeze.js with sails.js. Therefore I'm using the breeze json uriBuilder. I logged the req.query and got the following: { '{"where":{"name":"foo"},"orderBy":': { '"name"': '' } } To query waterline objects I need to bring it into a…
Alex
  • 89
  • 1
  • 6
0
votes
1 answer

Sails JS : Blueprint API : Get Many to Many Relationship by ID is not working

Followed the documentation to create Users to Pets - Many to Many Relationship in Sails JS V10.5 - BluePrint API with MongoDB v2.6 Yet localhost:1337/user/54e38754b27f02212458e68e/pets?name=Pinkie%20Pie Finding the Owner's Pet by Name works .. { …
Raj Rajen
  • 203
  • 2
  • 17
0
votes
1 answer

How can I restore lifecycle callbacks in sails?

After testing model creation, I noticed that lifecycle callbacks were not getting called and upon reading Waterline's documentation I found: NOTE: When using custom adapter methods the features of Waterline are not used. You no longer get the…
0
votes
1 answer

Find multiple random data using promise and recursion

I need to retrieve mutliple random data from my DB. I have made a service in Sails.js for that purpose. It's a Recursive function It generate a random number 0 to count of my DB. Stores the random number generated (All questions should be…
Luna
  • 496
  • 7
  • 18
0
votes
1 answer

Sails.js Waterline: User, Role, Task models, Please give me some suggestions on my final model design

This question might be related to database schema design in sails.js waterline. One task need to record different roles of users. For example, a Task need to know who are fooUsers and barUsers in this task. What is the best way to handle this? (foo…
user2309998
  • 697
  • 2
  • 7
  • 11
0
votes
1 answer

Sails/Waterline Populate doesn't work as expected

I'm bangin' my head against the wall in the last hours, and I can't figure out a solution to my problem. In my sails models, I have 2 one-to-many associations. 'A' model can have many 'B', and 'B' model can have many 'C'. In my controller, when I do…
Ze Luis
  • 236
  • 2
  • 15
0
votes
3 answers

Sails.js app fails to deploy on heroku

My sails.js application works fine on localhost but fails on heroku. I have below settings in my production.js port: process.env.PORT || 1337, environment: process.env.NODE_ENV || 'development', Still getting below messages and deployment…
aug70co
  • 3,965
  • 5
  • 30
  • 44
0
votes
1 answer

sails js save many to many is only one way

i have two models: user.js module.exports = { attributes: { ... profile: { model: 'Profile' }, groups: { collection: 'group', via: 'users', dominate: true }, roles: { collection:…