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

sending Model attribute methods to client Sails Angular

Is there a trick to send the Model attribute functions over Http gets ? so assuming i have a model User : attributes: { last_name : "string" , first_name: "string", name : function() { return this.first_name + " " +…
Adham
  • 490
  • 4
  • 12
0
votes
2 answers

Using same model inside beforeCreate in sails js

I am trying to check if the record exists inside the model using beforeCreate /api/models/User.js beforeCreate: function (values, cb) { User.findOne(values.email).exec(function findOneCB(err,found){ console.log('We found…
Gadelkareem
  • 1,067
  • 13
  • 30
0
votes
1 answer

How best to validate state transitions

I've created a sails model with a 'state' attribute: state: { type: 'string', defaultsTo: 'created', enum: ['created', 'pending', 'completed', 'rejected' ] }, I've constrained the attribute to finite states by using the…
gt3389b
  • 41
  • 4
0
votes
1 answer

Radio buttons always returning value of false to MySQL Database, regardless of specified value?

I'm creating a form using Sails.js. The form has multiple pages, and each time the user navigates to the next page, the data they've inputted to the form for the current page is submitted to a MySQL database. On one page of the form, there are two…
tedleahy
  • 69
  • 5
0
votes
1 answer

How to use several grunt tasks within the same closure?

I have several grunt tasks performing operations on my MySql database. In order to expose the database ORM, I first need to instantiate it and then run the database calls within the callback. The problem is that since every grunt task run…
m0g
  • 115
  • 1
  • 14
0
votes
1 answer

Waterline ORM - check if an array attribute contains values

I have a model with these attributes: attributes: { title: { type: 'string' }, tags: { type: 'array' } } How can I query whether or not the tags attribute contains some value? For example, I would like to select…
ChrisU
  • 473
  • 4
  • 14
0
votes
1 answer

Waterline queries similar to HQL

I have models in Sails as follows: User Model attributes: { firstName: { type: 'string', required: true }, lastName: { type: 'string', required: true }, company: { model: 'Company' } …
Abhishek
  • 1,999
  • 5
  • 26
  • 52
0
votes
2 answers

Why sails.js fails at startup?

I got this error after a try of linking the models (one-to-one): Temporarily using `sails.config.models.migrate="safe"... (press CTRL+C to cancel-- continuing lift automatically in 0.5…
alex025
  • 173
  • 1
  • 1
  • 13
0
votes
1 answer

Check for deleted data using Sails and Waterline

I am new to SailsJS and using it for an application and facing some issues with queries while deleting a Project Model Project Model: name: { type: 'string', required: true }, deletedAt: { type: 'datetime' …
Abhishek
  • 1,999
  • 5
  • 26
  • 52
0
votes
1 answer

How to find entity using their associate's attribute in waterline sails.js?

Please help me My issue describe as follow 1) User Entity var User = Waterline.Collection.extend({ identity: 'user', connection: 'local-postgresql', attributes: { firstName: 'string', lastName: 'string', // Add a reference to Pet pet: { model:…
Hardik Barot
  • 775
  • 1
  • 4
  • 17
0
votes
1 answer

sails.js unable to lift sails version 0.9.9 and sails-postgresql version 0.9.7

I am not able to lift sails version 0.9.9 with postgresql version 0.9.7 Here is the error message that I get debug: Lowering sails... /home/mandeep/iqr/thirstt/node_modules/sails-postgresql/lib/query.js:285 if(self._schema[key].type ===…
Mandeep Singh
  • 7,674
  • 19
  • 62
  • 104
0
votes
2 answers

Storing only necessary data in Sails Model

I am new to Sails and facing a small issue with models. I have defined a user model as follows: module.exports = { attributes: { firstName: { type: 'string' }, lastName: { type: 'string' }, email: { type:…
Abhishek
  • 1,999
  • 5
  • 26
  • 52
0
votes
1 answer

How can I insert a record into the db with sails-postgresql waterline ORM

I'm using sails js with the sails-postgresql adapter I receive the following error when trying to insert a record into the database. error: Sending 500 ("Server Error") response: TypeError: Object.keys called on non-object at Function.keys…
James
  • 680
  • 2
  • 8
  • 22
0
votes
1 answer

Date format upon retrieval

I am trying to retrieve dates from database in a recordset and print dates in mm/dd/yy mm:ss format in the view. Is it possible to intercept data in the model while retrieval and do formatting there instead of looping over recordset in the…
Me Unagi
  • 615
  • 2
  • 7
  • 18
0
votes
2 answers

Sails.js Waterline Query

I want to do the following, lets say for a simple group chat application, we have models like Message room: {'model':Room} Room users: {'collection':User} I want the following: Given a user Bob, get all Messages in a room containing Bob. What…
zzz
  • 233
  • 3
  • 8