Closed jrf0110 closed 11 years ago
Will be just like registering a table only we need to indicate that it's a view:
var dirac = require('dirac'); dirac.register({ name: 'users_with_groups' , type: 'view' , query: { type: 'select' , table: 'users' , columns: ['*', 'array_agg( users_groups.group ) ) as groups'] , joins: { users_groups: { type: 'left' , target: { id: '$users.id$' } } } } }); dirac.users_with_groups.find( { id: { $in: [1,2,3,4,5,6] } }, function( error, users ){ /* ... */ });
Will be just like registering a table only we need to indicate that it's a view: