When you do a Model.populate('project', {where: {org_id: ['15']}})
Should return the correct records but it actually returns records that do not match that. I have to assume that this is broken in waterline.
Using postgresql adapter.
My code:
if (query.org_id) {
console.log(criteria);
console.log(query.org_id);
org_criteria = module.exports.convert_string_to_array_selector(query.org_id, 'org_id');
console.log(org_criteria);
base_query = base_query.populate('project_id', {
where: {
org_id: org_criteria
}
});
}
My logs:
{ where: { state: 'ACTIVE' }, limit: 20, skip: 0 }
17
[ '17' ]
{ where: { state: 'ACTIVE' },
limit: 20,
skip: 0,
joins:
[ { parent: 'external_resource',
parentKey: 'project_id',
child: 'project',
childKey: 'id',
select: [Object],
alias: 'project_id',
removeParentKey: true,
model: true,
collection: false,
criteria: [Object] } ] }
Found Files: { project_id:
{ id: '7',
name: 'Nike2 Inc. People',
description: 'the people',
created_by: 'user1',
org_id: '5',
is_private: true,
is_user_default_project: false,
is_org_default: false,
type: 'PROJECT',
is_template: false,
color: 'rgb(223,115,255)',
state: 'ACTIVE',
createdAt: '2017-05-18T13:22:21.565Z',
updatedAt: null },
note_id: '6',
id: '3',
external_id: '070a00c03bcd11e7b0e19deb0847dfce.png',
version_id: null,
url: '/apps/intellinote/files/projects/7/070a27d03bcd11e7b0e19deb0847dfce',
name: 'small.png',
size: '220',
creator: 'user1',
type: 'FILE',
is_public: true,
state: 'ACTIVE',
mime_type: 'image/png',
internal_type: 'REGULAR',
is_template: false,
has_filled_data: false,
createdAt: '2017-05-18T16:22:23.000Z',
updatedAt: '2017-05-18T16:22:23.000Z' }
Notice how the query has an org_id of 17 on the project but the found record has an org id of 5.
via joncodo
No comments:
Post a Comment