You can add from , to and limit parameters to a GET /api/users/:_id/logs request to retrieve part of the log of any user. from and to are dates in yyyy-mm-dd format. limit is an integer of how many logs to send back
Log the inputs, your exercise log, and the output on the route in question and you’ll get this output on the last test:
eq.params: {"_id":"626b5ad52688e949bdea6834"}
req.query: {"from":"1989-12-31","to":"1990-01-04"}
[{"description":"test","duration":60,"date":"Mon Jan 01 1990","_id":"626b5ad52688e949bdea6837"},{"description":"test","duration":60,"date":"Wed Jan 03 1990","_id":"626b5ad52688e949bdea683a"}]
{
id: '626b5ad52688e949bdea6834',
user: 'fcc_test_16512027730',
log: [
{
description: 'test',
duration: 60,
date: 'Mon Jan 01 1990',
_id: new ObjectId("626b5ad52688e949bdea6837")
}
],
count: undefined
}
You’re count should be 2 since both records match the conditions, but it’s undefined. You’ll need to work through the conditionals in that route to find the problem.