(id, skip)
| 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); |
no test coverage detected
searching dependent graphs…