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 :

1221 questions
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
  • 655
  • 1
  • 6
  • 18
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,365
  • 4
  • 17
  • 31
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,056
  • 1
  • 8
  • 20
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
  • 660
  • 7
  • 19
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
  • 660
  • 7
  • 19
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
  • 341
  • 1
  • 3
  • 9
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,015
  • 2
  • 22
  • 39
0
votes
3 answers

sails 0.9.8 not work, when created controller and lift it

I have a problem with sails 0.9.8. I already installed sails on my mac and also lift, it work well, but when start generate controller and model then start lift command again it show some error like: $sails…
0
votes
1 answer

WaterlineJS find all not in ($nin)

I'm using the Waterline ORM (MongoDB adapter) with SailsJS and trying to return all documents that don't match the specified query along the lines of this: User.find({ id: { $nin: [array] } }).done(...) I understand that when…
btown
  • 33
  • 4
-1
votes
1 answer

Nesting objects in SailsJS models

how to put the full object workstation in another object userWorkstationSchedule? code: Workstation.js module.exports = { tableName: 'workstation', attributes: { name: { type: 'string', required: true, maxLength: 100, columnType:…
comodo
  • 1
-1
votes
1 answer

Make native query in standalone Waterline

When trying to use Waterline standalone mode, I could not find the correct method to perform native queries. With Sails.JS the sendNativeQuery method is used which I could not find in the instances of the models. Does anyone know how I can perform…
-1
votes
2 answers

WaterlineJS/SailsJS: Query array attribute contains a value

Suppose I have a model attribute tags: ['tag1', 'tag2', 'tag3']. I want to find models that have a certain tag. How do I do it? It appears contains does a string contains. Not array contains which I need?
Jiew Meng
  • 74,635
  • 166
  • 442
  • 756
-1
votes
1 answer

Node.js waterline-orientdb update fail

I am trying to create a simple server application in Node.js using the waterline-orientdb package where there are several users who can invoke several methods. Before a user can do anything, the user needs to authenticate with his username and…
Cerebres
  • 343
  • 2
  • 13
-1
votes
1 answer

Can a Waterline model access its collection in life-cycle events?

I have a model where only one record can have a 'current' property set to, for example, 1. Is it possible for the beforeCreate or beforeUpdate to access the collection. Basically I want to do something like this: afterUpdate: function (values, next)…
Andrew Eddie
  • 988
  • 6
  • 15
-2
votes
1 answer

How can i get the datas from find waterline?

In my data base i have these datas, for example: newYork Minessota I have this code: i want to find 'newyork' but i get nothing await school.findOne({ name }) What is the wrong? if i find newyork i want to find this data newYork, should not mind…
mikkylekyle
  • 133
  • 10
1 2 3
81
82