2017-05-23 6 views
0

을 작동하지 않습니다. 나는 이것이 수선에서 부러 졌다고 추정해야한다.워터 채우고 당신이 <code>Model.populate('project', {where: {org_id: ['15']}})</code></p> <p>올바른 레코드를 반환해야 할하지만 실제로 일치하지 않는 레코드를 반환하면 어디

postgresql 어댑터를 사용합니다.

내 코드

: base_query = base_query.populate('project_id', {org_id: org_criteria});

내 로그 : 쿼리가 프로젝트하지만 17의 ORG_ID을 얼마나

{ 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' } 

공지 사항

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 
      } 
     }); 
     } 

는 또한이 구문을 시도 발견 된 레코드의 조직 ID가 5입니다.

답변

0

오늘 현재 작동하지 않습니다. 돛. 부모는 필터하지 않고 자식 필터 만합니다. 사용자 지정 쿼리가 필요합니다. 이것은 LEFT 조인이며 일치하는 항목을 반환합니다.