MCPcopy
hub / github.com/Automattic/mongoose / getTeacherPosts

Function getTeacherPosts

test/model.populate.test.js:6343–6363  ·  view source on GitHub ↗
(id, skip)

Source from the content-addressed store, hash-verified

6341 });
6342
6343 function getTeacherPosts(id, skip) {
6344 const cond = { teacher: id };
6345 const opts = {
6346 sort: { title: -1 },
6347 limit: 1,
6348 skip: skip
6349 };
6350 const pop = {
6351 path: 'comments',
6352 options: {
6353 sort: { content: -1 },
6354 limit: 1,
6355 skip: 1
6356 },
6357 populate: {
6358 path: 'user',
6359 select: 'name -_id'
6360 }
6361 };
6362 return Post.find(cond, null, opts).populate(pop).exec();
6363 }
6364
6365 await User.create(users);
6366 await Teacher.create(teachers);

Callers 1

Calls 2

populateMethod · 0.80
findMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…