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
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,008
  • 2
  • 18
  • 34
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,266
  • 3
  • 12
  • 29
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,015
  • 2
  • 22
  • 39
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
0
votes
2 answers

Waterline unique validation not detected until the next sailsjs server reset

I am using sails@beta. I am trying to create several Room models (see definition) below, the problem is that I can successfully create Room models with the same attribute 'name', although attribute 'name' has a unique validation. The validation…
user2867106
  • 1,061
  • 1
  • 11
  • 29
0
votes
1 answer

lrange command on sails-redis

I'm new to sails.js. I want to issue a redis command on sails-redis like this, lrange SPECIFIC_KEY 0 10 but I can't see how should I write codes in my model for it. Documentation for sails-redis and waterline give me no hint to me. What should I…
hanas.syu
  • 3
  • 2
0
votes
0 answers

beforeValidation() didn't invoke for creating a record

beforeValidation() didn't invoke when the Model.create(obj) was called. modele.exports = { attributes : {}, beforeValidation : function(values, next){ console.log("Hello I am here"); //it didn't invoke when Model.create(obj)exec(); was called …
tebesfinwo
  • 655
  • 1
  • 6
  • 18
0
votes
1 answer

NodeJS - waterline best way to do 4 consecutive collections counts

I want to create a dashboard where I'll be showing simple stats like count of users, count of comments etc. I am counting my collections using something like User.count(function(err, num){ if (err) userCount=-1; else …
STE
  • 596
  • 3
  • 7
  • 18
0
votes
2 answers

Sails.js time as model's attribute

I wanted to ask, can anyone point me to any example of using 'time' as an attribute of a model? It's possible according to documentation http://sailsjs.org/#!documentation/models , but I can't find any examples, and I'd like to know what type is it…
jantar
  • 183
  • 2
  • 9
0
votes
1 answer

Sails.js - Get async data from an EJS file

Are there a good way to get async data from an EJS file? Sails.js only have async methods to get data from a database. I have a collection of Pages with their associated content Values. In some cases I want to get a specific Value from another Page…
Etienne
  • 2,015
  • 2
  • 22
  • 39
0
votes
1 answer

In Sails.js v0.10 after populating data as a value i get [Getter/Setter]

After populating data i get result not as expected. Example: //User.js Model module.exports = { attributes: { //"id" attribute is here primary key by default schools: { collection: 'School', via: 'id' }, name: { type: 'String', trim:…
Bogdan Le
  • 1,980
  • 1
  • 16
  • 18
0
votes
0 answers

Sails.JS (Waterline) self referential model on findAll() returns an empty array

I've created a selfreferential model in sails and when I try to create some items it works. But when I get to the findAll() method it returns me an empty array. I don't suppose it is a bug because I might failed with creating a selfreferential…
Nik
  • 113
  • 2
  • 9