Quality Assurance Projects - Issue Tracker

Tell us what’s happening:

I have passed every test except the following: You can send a GET request to /api/issues/{projectname} for an array of all issues for that specific projectname.
With the ouput:
{
“_id”: “66c5d18b36199c1772b1917d”,
“assigned_to”: “”,
“status_text”: “”,
“open”: true,
“issue_title”: “Mr”,
“issue_text”: “Donjo”,
“created_by”: “Wondimu”,
“created_on”: “2024-08-21T11:37:47.173Z”,
“updated_on”: “2024-08-21T11:37:47.173Z”,
“__v”: 0
}
I don’t know what else to do

###Your project link(s)

solution: https://3000-freecodecam-boilerplate-9mbw3gqka1v.ws-eu115.gitpod.io

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36

Challenge Information:

Quality Assurance Projects - Issue Tracker

Without being able to pull up your project page, I can only try to make this assumption:

The output you provided is an object:

Looking at this instruction:

I would suggest looking at how you are returning data. If you need to return multiple issues for the same project how are you structuring those issues?

Are you returning an array with each issue inside it like:

[
    {
        (Issue 1)
    },
    {
        (Issue 2)
    },
]

Hopefully this can be of some help

[
{
“_id”: “66c70a976439a202a0c9cc64”,
“issue_title”: “Mr”,
“issue_text”: “Functional Test”,
“created_on”: “2024-08-22T09:53:27.913Z”,
“updated_on”: “2024-08-22T09:53:27.913Z”,
“created_by”: “Donjo”,
“assigned_to”: “Kal”,
“open”: true,
“status_text”: “Not Done”,
“__v”: 0
},
{
“_id”: “66c70a986439a202a0c9cc67”,
“issue_title”: “Mr”,
“issue_text”: “Functional Test”,
“created_on”: “2024-08-22T09:53:28.162Z”,
“updated_on”: “2024-08-22T09:53:28.162Z”,
“created_by”: “Donjo”,
“assigned_to”: “”,
“open”: true,
“status_text”: “”,
“__v”: 0
},
{
“_id”: “66c70acd6439a202a0c9cc74”,
“issue_title”: “Mr”,
“issue_text”: “Dj”,
“created_on”: “2024-08-22T09:54:21.841Z”,
“updated_on”: “2024-08-22T09:54:21.841Z”,
“created_by”: “Broski”,
“assigned_to”: “”,
“open”: true,
“status_text”: “”,
“__v”: 0
}
]
I’m actually returning an array of objects just like the one from example.
And my GET request from my api.js is as follows:
.get(async (req, res) => {
let project = req.params.project;
try {
const projectName = await ProjectModel.findOne({ name: project });
let filteredObj = Object.assign(req.query);
if (!projectName) {
res.json([{ error: “Project not found” }]);
return;
} else {
const issues = await IssueModel.find(filteredObj);
if (!issues) {
res.json([{ error: “No issues found” }]);
return;
}
res.json(issues);
return;
}
} catch (err) {
res.json({ error: “could not get” })
}
})

Ohh…andadditionally, the error that keeps on coming is the following:
[Error: expected [ { …(10) }, { …(10) }, …(3) ] to have a length of 3 but got 5].

Whenever I’m submitting my work, the ‘5’ increases to ‘17’, then to 28 and so on. I’m guessing somewhere in my code, whenever the tests are being performed, additional issues are being added to my project.

Its hard to say exactly what is going on here still. I know it wont be the solution, but have you tried dumping all of the previous records for your issue tracker database and run the tests again? With a fresh database, if you create two new issues for a project and perform a GET request to view the issues, are you getting the two expected records in return?

Share a snapshot of your Gitpod workspace or post a GitHub repo.

Also, just another thought:

When you update a record with new data, are you verifying that its not creating a new record altogether? Double check that your ‘created_on’ and ‘updated_on’ fields are different after an Issue Update.