Skip to content

Instantly share code, notes, and snippets.

@dallonf
Created October 16, 2012 15:32
Show Gist options
  • Save dallonf/3900008 to your computer and use it in GitHub Desktop.
Save dallonf/3900008 to your computer and use it in GitHub Desktop.
Relationships in Deployd
// On GET /users
// Get all the todos that this user owns
if (query.includeTodos) { // Always make something like this a custom query; otherwise it's easy to bog down your server with unnecessary db calls
dpd.todos.get({userId: this.id}, function(res, err) { // Assuming that the userId property of a todo is set when you create it
this.todos = res;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment