I try to make a project with using of loopback and remote postgresql database. Tables are filled and I see it in pgAdmin.
I have this code:
/models/language.js
var loopback = require('loopback'),
app = require('../app');
loopback.createModel('languages', {
id: Number,
des_id: Number,
iso: String,
codepage: String
})
app.model('languages', { dataSource: 'pg' });
(I'm not agree with concept of using one file for storing all model definitions. But I'm agree that LDL is cool! ^_^)
"loopback-explorer" successfully shows my REST's for new model. But when I try to GET something it selects only "id" fields.
[ { id: 1 },
{ id: 4 },
{ id: 6 },
{ id: 7 },
{ id: 8 },
{ id: 9 },
...
]
It counts right number of entities.
This code has no effect of fintering:
app.models.languages.find({
where: {'des_id': 14360}},
function(err, langs) {
console.log(langs)
});
I get the same amount of data as in previous output.
I tried this
app.models.languages.find({
fields: {id: false}
},
function(err, langs) {
console.log(langs)
});
same effect.
I tried to create model without properties defenition:
loopback.createModel('languages', {})
same effect.
but
app.datasources.pg.discoverModelProperties('languages', function(err, props) {
console.log(props);
})
shows right scheme
Where I'm wrong?