Tell us what’s happening:
I think i’ve made a working solution, also the hint is pretty the same, but it dont get accepted from FCC. Some ideas? Have i done something wrong?
Thanks for your attention,
WKD
My code:
const findOneByFood = function(food, done) {
Person.findOne({favoriteFoods: food}, function (err, data) {
if (err) return console.log(err);
done(null, data);
});
};
No, today i get also an mongoose error so i cant start the repl. (no changes!) Yesterday this problem didnt show up, but the solution was not accepted… strange.
Anyway, maybe i try it anytime via Github repo and node.js…
The code is written and should work there, so it is not much work to swap…
(node:2333) Warning: Accessing non-existent property ‘count’ of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
(node:2333) Warning: Accessing non-existent property ‘findOne’ of module exports inside circular dependency
(node:2333) Warning: Accessing non-existent property ‘remove’ of module exports inside circular dependency
(node:2333) Warning: Accessing non-existent property ‘updateOne’ of module exports inside circular dependency
Your app is listening on port 3000
/home/runner/FCC-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/mongo_client_ops.js:474
throw err;
^
MongoError: database name must be a string
at Function.create (/home/runner/FCC-mongomongoose/node_modules/mongodb-core/lib/error.js:43:12)
at validateDatabaseName (/home/runner/FCC-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/db_ops.js:720:22)
at new Db (/home/runner/FCC-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/db.js:181:3)
at MongoClient.db (/home/runner/FCC-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js:268:14)
at /home/runner/FCC-mongomongoose/node_modules/mongoose/lib/connection.js:533:62
at /home/runner/FCC-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/utils.js:414:17
at executeCallback (/home/runner/FCC-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/utils.js:406:9)
at /home/runner/FCC-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/mongo_client_ops.js:294:5
at connectCallback (/home/runner/FCC-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/mongo_client_ops.js:249:5)
at /home/runner/FCC-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/operations/mongo_client_ops.js:471:7
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
driver: true,
[Symbol(mongoErrorContextSymbol)]: {}
}
exit status 1