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
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,139
  • 1
  • 13
  • 31
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
  • 715
  • 1
  • 6
  • 20
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
  • 656
  • 3
  • 8
  • 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,257
  • 3
  • 27
  • 41
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
  • 2,216
  • 1
  • 20
  • 21
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
  • 133
  • 3
  • 9
0
votes
1 answer

Returned object's Id is ZERO ( creating a record in database )

When I tried to print out the User using console.log(user); I discovered that the id was zero. However, in the database(mysql), the user id is showing the correct value, which is the uuid. Following is my User model module.exports = { tableName :…
tebesfinwo
  • 715
  • 1
  • 6
  • 20
0
votes
1 answer

How to return table in JavaScript in Sails.js from multiple models

I got 2 models, User and Friend. In friend i got 2 columns( UserId1, UserId2) I want to find in Friend rows where UserId1 is specified, and then from the table with these rows i want to return table with Users with Id = UserId2 index: function(req,…
CSharpBeginner
  • 1,625
  • 5
  • 22
  • 36
0
votes
0 answers

Can't do basic find with Waterline in sails console

I have a Job model that searches a table of jobs. The table was created using rails, and I set 'migrate' to 'safe' in the Job model. I have written out all the attributes in the model. I cannot get basic functions to work in the sails console. I…
RedMage
  • 1,126
  • 1
  • 9
  • 21
0
votes
1 answer

sails Waterline criteria "complex" conditions

I'm on a Node.js Sails app 0.10-rc4 with Waterline on mongoDB (sails-mongo adapter), and I've a model.where criteria condition that works good: or: [ { start: …
DestyNova
  • 726
  • 8
  • 21
0
votes
1 answer

What about the 'this' variable for models in embedded documents?

I'm kind of new in node.js and sails but it's easy so I like it :) I'm working actually with the sails Framework 0.10rc3 with MongoDB ans sails-mongo. I know that the contributors of waterline are not big fan of embedded documents in models as for…
DestyNova
  • 726
  • 8
  • 21
0
votes
1 answer

Sails how to transform string type in array to json

I have a simple REST application built in Sails and I want to save the correct data in a model attribute of type array. Route to…
Lucas Simon
  • 441
  • 1
  • 5
  • 10
0
votes
1 answer

Sails.js & MongoDB: duplicate key error index

I'm using Sails.js (0.9.8) and MongoDB (via the sails-mongo adaptor) to create a collection of pages that can be positioned in a tree-view. I would like to store the path of a page in an array of UUIDs My model: module.exports = { schema:…
Etienne
  • 2,257
  • 3
  • 27
  • 41
1 2 3
81
82