sails-postgresql

Sails js, how do we write inner join using populate

不羁岁月 提交于 2019-12-24 06:36:43
问题 Sails's populate works as Left join. I want to do as inner join, Anybody help me how we can write inner join using populate without writing raw query. I am using MYSQL adapter. 回答1: if you have for example two models user , contacts relation one-to-many you try to write something like :- first models will like this :- user.js module.exports = { schema: true, tableName: 'userdata', attributes: { anyField: { type: 'integer', required: false, size: 56, }, contacts: { collection: 'Contact', via:

SailsJS Schema Name Issue

孤人 提交于 2019-12-24 01:55:23
问题 I am trying to connect my SailsJS app to a postgres db that has another schema aside from 'public' The schema name of the postgres DB that I am connecting to is 'sales' Where am I am going wrong? Thank you! connection: 'postgres', tableName: 'user__c', meta: { schemaName: 'sales' }, attributes: { name: { type: 'string' }, picture_url: { type: 'string' } } 回答1: It's been so long but still, this is still an issue with waterline-sequel (0.5.0) in the latest version of Sails (0.11.x), and it has

Sails.js many-to-many associations throw error on create and populate

这一生的挚爱 提交于 2019-12-11 09:17:04
问题 When I try to associate one collection with another collection using a many-to-many association, I get the following error: Using sails-mongo: TypeError: Cannot read property 'where' of undefined at _afterFetchingJunctorRecords (/Users/grant/Sites/sails/test/node_modules/sails-mongo/node_modules/waterline-cursor/cursor/populateBuffers.js:131:35) at /Users/grant/Sites/sails/test/node_modules/sails-mongo/lib/collection.js:103:5 at /Users/grant/Sites/sails/test/node_modules/sails-mongo/node

get Selected fields in .populate() waterline-postgresql .populate('fieldName',{select:[]})

空扰寡人 提交于 2019-12-07 12:44:46
问题 select query is not working in .populate() of waterline-postgresql. Model.find(query).populate(assoc.alias,{select:['field1','field2']}); This is not working in waterline-postgresql adapter. Is this not supported or Am I making any mistake? 回答1: select is not supported in .populate(). You can see this github issue. In populate select is not working currently. This is feature request and it is open issue. hope in next release waterline team will introduce this feature. 回答2: Since there's no

Using sails.js with an existing postgres database

筅森魡賤 提交于 2019-12-05 14:48:38
问题 I was looking at using Sails for an app that we are developing. I'm using the sails-postgresql adapter which uses the waterline orm. I have an existing database that I want to connect to. If I create a model using generate something and then in my model I have attributes:{ title:{type:'String'} } If I browse to localhost/something the orm deletes all the columns in the something table except title. Is there a way to stop it from doing this? This app should not delete columns on this database.

Using sails.js with an existing postgres database

无人久伴 提交于 2019-12-04 00:30:35
I was looking at using Sails for an app that we are developing. I'm using the sails-postgresql adapter which uses the waterline orm. I have an existing database that I want to connect to. If I create a model using generate something and then in my model I have attributes:{ title:{type:'String'} } If I browse to localhost/something the orm deletes all the columns in the something table except title. Is there a way to stop it from doing this? This app should not delete columns on this database. Thanks! I am the author of Sails-Postgresql. Sails has an ORM called Waterline that it uses for