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
14
votes
2 answers

How to start a new project with MEAN and sails.js

I have created a web app with node.js, express, and angular.js in the past. I am starting a new project and I want to also use MongoDB. That would be the MEAN stack. Using just MEAN, I could start a project with this: http://mean.io/. Now, I have…
Jess
  • 23,901
  • 21
  • 124
  • 145
13
votes
1 answer

Chaining waterline calls with Promises

I have been hitting my head off a wall on this for the last 3 days. I am using sailsjs & the waterline ORM that comes bundled. I want to run DB calls one after an other. I know I can do this by nesting inside "then" calls but it just looks wrong. I…
Brian
  • 1,026
  • 1
  • 15
  • 25
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,961
  • 8
  • 31
  • 49
13
votes
8 answers

How to show queries in console log using sails?

I am starting a project with sails and mysql, and I do'nt know how configurate it to show the queries executed in the console.
demonodojo
  • 392
  • 1
  • 3
  • 7
13
votes
2 answers

Sails.js find multiple database entries by id

I'm bit new at node.js/sails.js and was wondering (if possible) how to retrieve multiple database entries by searching for their ids - there is something like this mentioned in the MongoDB documentation: db.inventory.find( { qty: { $in: [ 5, 15 ] }…
prototype
  • 3,303
  • 2
  • 27
  • 42
12
votes
1 answer

Aggregate match pipeline not equal to in MongoDB

I am working on an aggregate pipeline for MongoDB, and I am trying to retrieve items where the user is not equal to a variable. For some reason, I couldn't make it work. I tried to use $not, $ne and $nin in different possible way but can't make it…
alexmngn
  • 9,107
  • 19
  • 70
  • 130
12
votes
1 answer

How to use Sequelize in SailsJs

Waterline is an excellent ORM but I noticed that there are many features that are not present yet on waterline but Sequelize already have. So I have decided to switch to sequelize but still using Sails for the others things. I have search tutorial…
Miguel
  • 1,577
  • 2
  • 15
  • 29
12
votes
6 answers

Unique property fails in Sails.js

The following code represents an Account Model in Sails.js v0.9.4 . module.exports = { attributes: { email: { type: 'email', unique: true, required: true }, password:{ type:…
georgez
  • 737
  • 1
  • 8
  • 20
12
votes
3 answers

Transactional SQL with Sails.js

So I have been playing with NodeJS/Express for a little with now and I would really like to try to rewrite a relatively large side project using a full JavaScript stack just to see how it will work. Sails.js seems to be a pretty good choice for a…
ryanzec
  • 27,284
  • 38
  • 112
  • 169
12
votes
1 answer

Using sails.js with an existing postgres database

I was looking at using Sails for an app that we are developing. I'm using the sails-postgresql adapter which uses the waterline orm. I have an existing database that I want to connect to. If I create a model using generate something and then in my…
Senica Gonzalez
  • 7,996
  • 16
  • 66
  • 108
11
votes
2 answers

How to select, groupBy, and join in Waterline or MongoDB

I have three models: user, noun, and usernoun (user_noun in PHP/Eloquent). There is a many to many relationship between user and noun. The "pivot" table has an extra attribute score. I can use this query with Eloquent to sum the scores of each noun…
twharmon
  • 4,153
  • 5
  • 22
  • 48
11
votes
2 answers

Sails.js/Waterline populate deep nested association

I understand that there is no built-in way in Sails.js/Waterline of populating deep nested associations yet, so I am trying to use bluebird promises to accomplish that but I'm running into a problem. I'm successfully retrieving the user, and all the…
Sávio Lucena
  • 113
  • 1
  • 1
  • 4
11
votes
1 answer

Is it possible to rename `createdAt` and `updatedAt` in sails.js / waterline

Using Waterline ORM from SailsJS, my defaults for autoCreatedAt and autoUpdatedAt are set to false, but I still need to implement to the functionality just using different field names (DBA request). Is there a way to either: specify different…
Andrew Eddie
  • 988
  • 6
  • 15
11
votes
4 answers

How to use Model.query() with promises in SailsJS/Waterline?

I'm having issues with Sails.JS 0.9.8. I would like to use promises with the Model.query() function (I use sails-mysql adapter). This code will work : User.findOne({ email: email }) .then(function(user) { console.log(user); }); but this one…
Yann Pellegrini
  • 793
  • 3
  • 7
  • 19
11
votes
3 answers

Waterline ORM (sails.js) conditions with NOT Equal in query

How can I write a NOT Equal condition in Waterline? This code: Users .count() .where({ id: { '!=': req.params.id}, lastname: req.body.lastname }) Does nothing... (disk adapter in sails.js)
Igor
  • 825
  • 2
  • 7
  • 18
1
2
3
81 82