Im stuck on 'Use model.findById()...'

i’m stuck on this challenge: Use model.findById() to Search Your Database By _id.
Both my code and the solution code of freecodecamp give out an [object Object], failing the test. I have no idea where it goes wrong.

app.js code (commented out code is my own, the not-commented out code is the freecodecamp solution):
const findPersonById = (personId, done) => {
if(err) return console.error(err);
done(null, data);
var findPersonById = function(personId, done) {
Person.findById(personId, function (err, data) {
if (err) return console.log(err);
done(null, data);

Console output:
node v12.16.1
[object Object]
[object Object]

Your project link(s)

solution: boilerplate-mongomongoose - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0

Challenge: Use model.findById() to Search Your Database By _id

Link to the challenge:

I forked your project and added my own MONGO_URI and it passes the challenge with no strange output. Are you seeing any errors in the Node console when npm start runs?

Thanks for your help.

This is the console log:

npm start
fcc-mongo-mongoose-challenges@0.0.1 start /home/runner/boilerplate-mongomongoose
node server.js
the options [useUnifiedTopology] is not supported
Your app is listening on port 3000
(node:995) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
[object Object]
[object Object]
[object Object]

It’s weird, but to pass test findPersonById and all the following ones except the last, I had to put in the solution links one for one again in the fCC “Back End Development and APIs”(, then it passed…
However the last challenge Nr 12, it doesn’t work with this helparound.
Now Im stuck again, even though the solution should be fine (checked it with hints and a YouTuber who went through the challenges.)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.