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

Sails.js Waterline Model Storage

I'm trying to store a large chunk of text as part of a model in Sails.js. However, it seems that the text is getting cut off after some length. Is there a limit set on how long the 'string' type can hold in a model? If so, what's the best way around…
kk415kk
  • 1,227
  • 1
  • 14
  • 30
0
votes
1 answer

SailsJS how to correct this promise issue?

I use sails.js to update stock data from difference variable. When I do, console.log(product.stock), the value is 4. But it seems product.save() function below is not executed because attribute stock still not changed to 4. I guess the problem is at…
Pewh Gosh
  • 1,031
  • 1
  • 11
  • 29
0
votes
2 answers

How use a findOne query method in a custom instance method

I'm trying to do the following: // Task Model module.exports = { schema: true, attributes: { directProy: { type: 'string', required: true }, user: { type: 'string', required: true }, …
Cristian G
  • 779
  • 2
  • 10
  • 21
0
votes
2 answers

sails.js Logic error in mySQL ORM error catching

In my user model I have: module.exports = { attributes: { username: { type: 'string', unique: true, required: true, minLength: 5, maxLength: 15, …
RMK147
  • 191
  • 1
  • 4
  • 15
0
votes
2 answers

As I can use different models in the same controller action

I'm trying to send to the view, information from multiple models as follows: var tareasGlob = ""; var directoresProy = ""; var usuariosGlob = ""; var proyectosGlob = ""; module.exports = { 'index' : function(req, res, next){ // De esta…
Cristian G
  • 779
  • 2
  • 10
  • 21
0
votes
1 answer

Using Waterline find method with promisses

I'm stuck when it comes to returning response, from method that includes database call. Here's sample of what I need... service.js module.exports = { getUserStatus: function(userId){ return User .find() …
Ned
  • 3,961
  • 8
  • 31
  • 49
0
votes
1 answer

Date and datetime set to null in beforeValidate transforms to '0000-00-00' and throws error

I've looked quite extensively around for an answer to how to handle my date-related problem, but I can't seem to find a proper answer anywhere. I'm using SailsJS (beta) with Waterline as the data-handler. My case is as follows: My User-model is as…
hansmei
  • 660
  • 7
  • 17
0
votes
1 answer

sails js JSON attribute does not save serialized JSON object properly

I am trying to save a 3D array in MongoDB, so obviously I decided to save the data as JSON. For simplicity, I am trying to save Weekly Food Menu, so the array dimensions are: Week x Day x ArrayOfMenuItems. Restaurant.js (Model) menuItems: { …
user2867106
  • 1,139
  • 1
  • 13
  • 31
0
votes
1 answer

Creating Model Properties using Function

I'm trying to add the property 'board' (an object) for my model by using a function so that I can utilize multiple values from the request body to create the object. Obj.create({ name: req.body.name, admin: req.user.id. …
Seth
  • 659
  • 2
  • 7
  • 21
0
votes
2 answers

Waterline applies model changes to mysql db for one model/table, but ignores another

I'm currently working on a completely new project with sailsJs, using waterline on a mysql adapter/connection. For now, all I have are 2 tables/models. One is User, which seems to work as expected. Any changes I make to this model are applied to…
SirDemon
  • 1,758
  • 15
  • 24
0
votes
1 answer

why object inside toJSON is null if we return him from callback? (Waterline)

I have TopPlayer model: module.exports = { attributes: { league_id: 'number', playerid: 'number', playerimage: 'url', teamimage:'url', teamname:'string', season: 'string', player: 'string', assets: 'number', …
vromanch
  • 939
  • 10
  • 22
0
votes
1 answer

Is it possible to use custom attributes as criteria in my query

I'm wondering, is it possible to use a custom attribute in sails to query certain records? Maybe my example below will explain it better. models/User.js attributes: { first_name: 'string', last_name: 'string' } models/ModelA.js attributes: { …
ginad
  • 1,863
  • 2
  • 27
  • 42
0
votes
1 answer

Can SailsJS use existing mongo data with string _id fields?

Can SailsJS mongo adapter (sails-mongo) use existing mongo data (not created via SailsJS) with string _id fields (as opposed to ObjectIds)?
Dinana
  • 300
  • 3
  • 14
0
votes
0 answers

Can't delete objects in waterline mongo

I'm using mongodb and waterline to try to delete something a node from my collection and it doesn't work User.find({}).done(function(err, myObjects){ console.log(myObjects[0].id) }) "myId" User.find({}).done(function(err, myObjects){ …
Carson Wright
  • 323
  • 3
  • 12
0
votes
1 answer

TypeError: Cannot read property '_attributes' of undefined after update

TypeError: Cannot read property '_attributes' of undefined After I rebuild my sails app to sails@0.10-rc6 and sails-mysql@0.10-rc5. Logs : TypeError: Cannot read property '_attributes' of undefined at…
tebesfinwo
  • 715
  • 1
  • 6
  • 20