Advertisement
Guest User

Untitled

a guest
Oct 12th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. import { model } from 'redink';
  2.  
  3. model('user').find({
  4. filter: (user) => user('name').eq('Dylan').or(user('age').gt('23')),
  5. include: { pets: true, blogs: true },
  6. without: { password: true },
  7. }).then(user => {
  8. return user.fetch('pets');
  9. }).then(pets => {
  10. return pets.map(pet => pet.update({ age: pet.attribute('age') + 1 }));
  11. }).then(updatedPets => {
  12. return updatedPets.every(pet => pet.attribute('age') > 6);
  13. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement