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

How can I use Sails.js without Waterline?

I tried out Sails v10 beta and liked associations in Waterline. However, I would like to try out the Sails framework using the native MongoDB driver sans any ORM. Is there any easy way to do this? Or are Waterline and Sails.js tightly coupled…
amarprabhu
  • 350
  • 3
  • 10
0
votes
1 answer

Cannot find using self reference associations in Waterline - Sails.js - MongoDB

I'm trying to create a tree structure using associations in Waterline which in the end connects to a MongoDB database. The definition of a treee no is: TreeNode.js module.exports = { attributes: { name: 'string', …
Omplog
  • 11
  • 1
0
votes
1 answer

beforeCreate function is not executing sequentially

After update my sails (0.10-rc5), I encountered a problem in beforeCreate function : beforeCreate : function(values, next){ console.log("Called beforeCreate User "); console.log(values); if(!values.password || values.password…
tebesfinwo
  • 715
  • 1
  • 6
  • 20
0
votes
0 answers

Client side database sync options

Is there any nodejs library that we can use to sync database between client and server while using Sailsjs. I know Meteor has a out of the box library for doing that, but the reason I prefer sailsjs because it is easy to use any npm module with it,…
0
votes
0 answers

Sailjs - Can I populate associations via a querystring parameter?

I'm playing around with the SailsJS beta and want to know if I can populate associated models via a querystring parameter (by default). I tried http://localhost:1337/firstModel?populate=secondModel but no luck. Is this something I'll have to…
davepreston
  • 1,260
  • 1
  • 10
  • 20
0
votes
1 answer

Sailjs/Waterline - Is there any way to get previously fetched objects?

I believe that I saw somebody wrote about a way to fetch the in-memory objects from a model object to reduce DB access. Could some body please advise or share me the document? I would like to have something like…
Ducky
  • 2,754
  • 16
  • 25
0
votes
1 answer

NodeJS and asynchronous process with models

I work with the last beta version of Sails / Waterline for NodeJS, the association system isn't ready yet so i'm trying to find a way to populate datas from other models with a small trick. For example, I got a "User" model which has many "Server",…
Laurent
  • 2,284
  • 2
  • 21
  • 41
0
votes
0 answers

How to access related models in defining a custom attribute

I'm trying to define a custom attribute in my sails model and I want to access a certain field in a related table how do I do this in sails? Please check my sample code below Example: // models/User.js attributes: { name: 'string', ... //…
ginad
  • 1,863
  • 2
  • 27
  • 42
0
votes
2 answers

Multiple model updates in sails waterline

I'm building a project on sails (0.10.0-rc5) for a few days and in a few cases i need to update multiple entries at once with the same data so I made something up ... Servers.find({owner_id: anonymous_user.id}).exec(function(error, servers) { …
Laurent
  • 2,284
  • 2
  • 21
  • 41
0
votes
1 answer

Sails.js 0.10.0-rc5 many-to-many association: remove

i'm developing an app with sails.js beta and mongodb. I've two models in a many-to-many association, i can successfully associate and populate instances of these models using .add() and .populate() methods. My problem is now that the .remove()…
Massimo Guidi
  • 150
  • 1
  • 1
  • 8
0
votes
1 answer

Populate 3rd model in Sailsjs and Waterline

Say I have three models: user projects files User has many projects and project has many files. If I run the following in console: User.find().populate('projects').exec(function(err,r){console.log(r[0].toJSON())}); I will see all projects but no…
Kory
  • 1,396
  • 3
  • 14
  • 31
0
votes
1 answer

How to retrieve related models in Sails.js loop?

I'm quite new to the Sails.js (and node) scene. Currently i'm creating an app in which users can create blogposts and view them afterwards. It all went well retrieving the posts on the index page, although i'm running into trouble when i'm trying to…
Lars Dol
  • 765
  • 1
  • 6
  • 14
0
votes
1 answer

Sails.js - Querying array size

// Item.js schema: true, attributes: { testArray: { type: 'array', required: true, array: true } } I would like to find all items where the testArray attribute have a specific length. I tried with this code below,…
Etienne
  • 2,257
  • 3
  • 27
  • 41
0
votes
1 answer

Building an api with Express and Waterline ORM

I'm trying to build an API with Express and Waterline ORM. The adapter I'm using is mongodb-adapter. The reason I'm trying to do this from outside Sails is that I want better understand the Waterline ORM so I can contribute to the Sails Couch…
JoelV
  • 85
  • 1
  • 8
0
votes
2 answers

Sailsjs Waterline's Query method calls cast function to undefined attributes

I'm using Waterline (Postgresql database) method Model.query(). For example: (the sql query is actually much more complicated :) ) Model.query('select * from user', function(err, result) { }); and there is such error: TypeError: Cannot read…
Stewie
  • 11
  • 4