Skip to content

Instantly share code, notes, and snippets.

@ritch
Created September 25, 2012 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ritch/3782825 to your computer and use it in GitHub Desktop.
Save ritch/3782825 to your computer and use it in GitHub Desktop.
Automatic Property Examples
// /students collection
// grades automatic property
var student = this
, query = {
courseId: {
$in: student.courses
}
};
dpd.assignments.average('grade', query, function (avgGrade) {
// set the value
set(avgGrade);
});
// from another collection or client
// get the top 10 students
dpd.students.get({$sort: 'grade', $limit: 10}, function (topStudents) {
console.log(topStudents);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment