Skip to content

Instantly share code, notes, and snippets.

@jrf0110
Last active August 29, 2015 14:12
Show Gist options
  • Save jrf0110/637a9a1842a1c2ac8c6c to your computer and use it in GitHub Desktop.
Save jrf0110/637a9a1842a1c2ac8c6c to your computer and use it in GitHub Desktop.
var db = require('./db');
db.restaurants.findOne( 25, {
one: [ { table: 'regions', alias: 'region'
, pluck: [{ table: 'region_zips', alias: 'zips', column: 'zip' }]
}
]
}, function( error, restauarant ){
console.log( error, restauarant );
});
// Resulting restaurant:
// {
// id: 25
// , ...
// , region: {
// id: 1
// , ...
// , zips: [ '12345', '23456', ... ]
// }
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment