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

SailsJS the best way to show all mongodb collections in view

I try to do a admin panel in SailsJS and i want show in a view all collections in a mongo database selected in connection.js but i dont know to do that. Can i create a model without waterline and require mongoose in a model for this…
0
votes
0 answers

How to deal with nested or connected Waterline queries?

I'm iterating over an array, I'm using findOrCreate method to add new records and I want show all records at the end of the action... Here is what I have: var counter = 2000 for (var i = 0; i < arr.length; i++) { var…
scaryguy
  • 7,720
  • 3
  • 36
  • 52
0
votes
1 answer

Can I use the sails's query modifier "contains" with a collection of objects?

I'm trying to obtain all objects that have an especific object in a collection. Example: Object Company has a collection of Employees, and I want to find all Companies who have a especific Employee on this collection. What I'm trying to do…
Sidney
  • 141
  • 5
0
votes
1 answer

How can I send a response in beforeCreate function?

I would like to respond with a 406, when the user tries to set their password to a length less than 8 characters. I am doing this validation in the beforeCreate function on my model. But Sails responds with a 500 and an Internal Server Error…
justspamjustin
  • 1,730
  • 3
  • 19
  • 30
0
votes
1 answer

findOrCreate creates duplicates

I'm using oracle adapter, async.each and findOrCreate to transfer some data from oracle to my postgres db: //simplified version oracle.select(sql, [], function(err, results) { async.each(results, function(add_me, async_cb){ …
maialithar
  • 3,065
  • 5
  • 27
  • 44
0
votes
0 answers

Nodejs multiple request in a row

I'm developing nodejs application with users registration using sails. I have an /signup method, which is looking for existing user, if user not found, it will create new user in db. As you know in sails model (waterline) available few methods :…
vromanch
  • 939
  • 10
  • 22
0
votes
1 answer

Retrieving one-to-one associations on multiple records

This returns the proper amount of records, but, account is only populated in the first record. The query waterline produces is also correct and returns all the associated data for every record. populateAll() has no effect. Swapping .then for .exec…
brian
  • 2,745
  • 2
  • 17
  • 33
0
votes
1 answer

How do I reference a field value when updating records using Waterline ORM

I'm trying to store a hierarchical structure using the Nested Set Model technique. I'm using Waterline ORM for node to query and update my database. How would I model the following query using Waterline? UPDATE MyTable SET counter=counter+2 WHERE id…
alarner
  • 175
  • 1
  • 7
0
votes
1 answer

Sails.js - Many-to-Many fails to save

I have a simple need to add tags to patients. I followed the Sails and Waterline documentation concerning many-to-many associations, but it's failing at some point (no errors). I'm using MongoDB for data storage. Code below: Tag Model module.exports…
Matt Shultz
  • 312
  • 3
  • 10
0
votes
0 answers

Can I reach to Couchbase Lite database using Sails.js on a same device

I have a thought regarding using Sails.js and Couchbase Lite(CouchDB) on same Cordova(PhoneGap) project and device. I think, a Sails application is dependent with a Node.js that provides to reach a database. If I try to reach a mobile database like…
efkan
  • 12,991
  • 6
  • 73
  • 106
0
votes
1 answer

How do Custom Attribute Methods work in Sails js

According to the documentation Custom Attribute Methods can be defined on the model, and then later used on objects returned from Queries made through Waterline, Sails JS's ORM. This is not working for me. I am getting the correct data back from…
toddgeist
  • 902
  • 9
  • 21
0
votes
1 answer

sails.js join tables on mongodb native id

I have two collections in mongodb database and model for each of them App Model module.exports = { tableName: 'app', attributes: { _id : { primaryKey: true, unique: true, type: 'string', …
styopdev
  • 2,604
  • 4
  • 34
  • 55
0
votes
1 answer

How-to manual add unique for all table in mongodb?

I use sails-mongo for working with models, I have a few attr with unique: true, but recently, this option does not work in the bug tracker said that it is necessary to add yourself this unique option, and then run using the migrate: safe. But I do…
0
votes
1 answer

SailsJS / Waterline - How do I use a 'string' index in models and associations?

Newbie question here. According to https://github.com/balderdashy/waterline#indexing you cannot use a 'string' datatype as an index in Waterline due to issues with case insensitivity: There is currently an issue with adding indexes to string…
Kenneth Benjamin
  • 378
  • 2
  • 16
0
votes
1 answer

Extract common code from sails.js / mongodb

I'm current trying to use sails.js with mongodb, I need some custom mapReduce function to group data. Now I could achieve what I want by using waterline's native function, but have some questions. These function has only small variation actually,…
Brian Hsu
  • 8,781
  • 3
  • 47
  • 59