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
7
votes
1 answer

how to use the attribute type like 'array' and 'json' in sails

Sails have support very convenient model througth Waterline, and I have used the 'array' attribute type in the way storing many string, but now I want to store more complex object, Although I can store the raw data in mongo by 'array' type, I don't…
user2590223
  • 81
  • 2
  • 5
7
votes
2 answers

Sails js using models outside web server

I want to create a cli to create admin users I have the user model setup in api/models/User.js and in cli on var User, program; program = require("commander"); User =…
carlitux
  • 1,217
  • 10
  • 14
6
votes
1 answer

How to properly instantiate a Waterline Model Object from a sails-mongo native result?

I am using SailsJS on a project and I need to use native() for certain querys. The problem I have is that I can't find a proper way to instantiate a Waterline Model Object from the mongo collection find result. I have being searching information…
6
votes
1 answer

Sails.js : Joins

var obsType = (from lk in db.LookUp join lt in db.LookUpType on lk.LookUpTypeId equals lt.LookupTypeId where (lt.FieldName == "OBSType") …
6
votes
2 answers

Is Mongoose better than waterline in a Sails app?

I am developing a sails.js app. In my previous sails app, I used MySQL with the default waterline ORM. I am planning to use Mongodb in my new app. I have come across limitations with waterline, one of them being, querying an association. My current…
Jaseem Abbas
  • 5,028
  • 6
  • 48
  • 73
6
votes
1 answer

Sails hook passport

I'm trying to implement Passport strategies into a sails hook, like this I can share on multiple project. When I try to log I have this error : Error: passport.initialize() middleware not in use at IncomingMessage.req.login.req.logIn…
jaumard
  • 8,202
  • 3
  • 40
  • 63
6
votes
1 answer

Node.js multi platform project structure

Its really confusing to setup the best project structure for node.js I'm developing node.js application that works on Browser, Mobile and Desktop. This application has many modules like billing, support, dashboard etc.. I started with express.js MVC…
sravis
  • 3,562
  • 6
  • 36
  • 73
6
votes
1 answer

Sails.js Model: create 2 association to self failed

I'm pretty new on Nodejs and sails. I'm implementing a server which is similiar to Twitter. In user model, there should be 2 fields: follower and following, and the 2 fields are association of the model 'user' itself. My question is when the model…
Renyuan wang
  • 171
  • 2
  • 9
6
votes
1 answer

Foreign key constraint on SailsJS

This is my College model module.exports = { attributes: { name:{ type:'string', required:true }, location:{ type:'string', required:true }, faculties:{ …
Bipin Bhandari
  • 2,694
  • 23
  • 38
6
votes
1 answer

Sails.js : Waterline foreign key association missing in MySQL

I am using waterline ORM in sails.js. I have a user model and another coins model which associates to the user model. //coins.js attributes: { name: 'string', // Associations userId: { model:…
Jaseem Abbas
  • 5,028
  • 6
  • 48
  • 73
6
votes
3 answers

sails.js - I want to add DB connection dynamically after sails lift

During sails lift I don't yet have all the connection information for my DB. Is there a way to either have config values dependent on promises or dynamically create a connection after sails lift has completed? I would obviously have to add a policy…
davepreston
  • 1,260
  • 1
  • 10
  • 20
6
votes
2 answers

Between Dates using Waterline ORM SailsJS

Goal: Return a list of items that were created between two dates. According to this issue https://github.com/balderdashy/waterline/issues/110 there is no between function just yet. However the work around is the following: User.find({ date: {…
Alexei Darmin
  • 2,079
  • 1
  • 18
  • 30
6
votes
2 answers

Sails.js worker node without http endpoint

I am building a sails app that uses a RabbitMQ do delegate some tasks from the web requests to a worker node. This is pretty much the pattern described in https://devcenter.heroku.com/articles/background-jobs-queueing and…
Manuel Darveau
  • 4,585
  • 5
  • 26
  • 36
6
votes
1 answer

Sails + Mysql multi-tenant

I'm starting a new project and I want to use AngularJS as Frontend and SailsJS as Backend. I have a requirement to separate databases for different clients. So, each client must have its own database. I didn't find how to make this in Sails and…
Clayton Kuhn
  • 71
  • 1
  • 4
6
votes
1 answer

Sails.js + Waterline: Many-to-Many through association

I'm new to Sails.js (v0.10.5) and Waterline ORM. I have 3 tables in database: users (id, name), roles(id, alias) and join table users_roles(user_id, role_id). It's important not to change table names and field names in database. I want Policy entity…
Ivan Kalita
  • 2,197
  • 1
  • 18
  • 31