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 :

1221 questions
54
votes
2 answers

SELECT and UPDATE multiple records in oriento / orientjs and transaction in waterline

How can I select or update multiple records in oriento? Like in waterline we can offersModel.update({id:items_ids,status:INACTIVE},{status:ACTIVE}) But in waterline transaction is not available. So I want to use : var db =…
9me
  • 1,022
  • 9
  • 31
39
votes
2 answers

npm install not installing latest version on GitHub

I have a module called 'sails-mongo' and I want to update it to the newest version using the following command: npm update sails-mongo --save I also tried uninstall then install again. I tried sails-mongo@latest and sails-mongo@beta. Problem: The…
user2867106
  • 1,061
  • 1
  • 11
  • 29
22
votes
4 answers

Sails.Js - How I do pagination in sails.Js

I want to create paginated table using sails.js, mongodb and waterline-ORM. Is there a any specific way to do pagination in sails.js?
sasitha999
  • 336
  • 1
  • 3
  • 10
22
votes
2 answers

How to perform SQL Joins and Relations in Sails.js and Waterline?

Can anyone guide me on how to setup relational schema & performs joins in sails.js?
Brieuce Wayne
  • 282
  • 1
  • 2
  • 8
18
votes
2 answers

Sails.js best practice in using transactions with promises (Postgres)

I'm using sails 0.9.16 with Postgres and my question is: what is the best way to execute transaction using current API with promises? May be there is something better than: Model.query('BEGIN TRANSACTION', function (err) { if (err) { …
Zuker
  • 955
  • 1
  • 7
  • 12
18
votes
1 answer

Is there a way to disable waterline and use a different ORM in sails.js?

I'd like to replace waterline with mongoose in my sails.js application. I'm looking for the correct way to do this, but I don't see how in the documentation. Can anyone explain how to do this?
Vadorequest
  • 12,672
  • 17
  • 87
  • 183
16
votes
1 answer

How to selectively populate waterline associations via query param in sails.js

By default, sails will populate all relationships within a model when it's corresponding API route is hit. Does anyone know if it's possible to toggle this functionality? If I'm working with a one-to-many association, I may not want to populate the…
Jason Sims
  • 1,138
  • 2
  • 10
  • 22
15
votes
2 answers

How to Log in SailsJS

What is the actual syntax to log in SailsJS? Docs don't have anything, but found the following line in the site's roadmap "Pull out Sails.log (winston wrapper) as a separate module so it can be used by waterline" I image it's something…
binarygiant
  • 5,982
  • 10
  • 44
  • 64
15
votes
5 answers

How to create a normal sails model without being in the models folder

So, I'm in the middle of implementing a plugin api for my application, and the plugins can have their own models, imagine this. SimplePlugin = { pluginName: 'simple', pluginConfig: {}, SimpleModel: { attributes: { …
iConnor
  • 19,153
  • 13
  • 57
  • 91
14
votes
1 answer

Sails.js/Waterline cascading delete for a many-to-many association

As shown in that stackoverflow answer, having no support for cascading (cascading deletes in particular) in Waterline there is a workaround for one-to-many associations by using the afterDestroy (or afterUpdate for soft-delete) lifecycle callback…
Radko Dinev
  • 814
  • 7
  • 15
14
votes
3 answers

Change field name for CreatedAt / UpdateAt Attributes

I am attempting to model an existing MSSQL table in SailsJS. Unsurprisingly the tables in the existing database have a createdAt and updatedAt column similar to what is generated by the SailsJS framework. Is there a way to assign the value of the…
JCKortlang
  • 227
  • 2
  • 9
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
  • 20,424
  • 18
  • 108
  • 130
14
votes
2 answers

Waterline ORM (sails.js) "where or" in query

I would like to know how to add "OR" condition in waterline query. Should look like: User.find().where({ score: { '>': req.params.score}, status: 'user' OR status: 'admin' }).exec(function(err, data){ ... }); So we have 2…
Igor
  • 680
  • 2
  • 5
  • 18
13
votes
4 answers

Select specific fields from database

I just want to know that is it possible to select specific fields using waterline, orientdb query is given below. e.g. select phone from user I want to select phone from user vertices by using this…
Zeeshan
  • 343
  • 1
  • 3
  • 15
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…
codemeasandwich
  • 1,260
  • 1
  • 13
  • 23
1
2 3
81 82