Tell us what’s happening:
i get this alert that test is timed out and unable to create and save a person
Your code so far
https://repl.it/@meeramenon07/boilerplate-mongomongoose#.replit
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 10; SM-A107F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.111 Mobile Safari/537.36
.
Challenge: Create and Save a Record of a Model
Link to the challenge:
When I tried to run your code I got this error:
ReferenceError: findOneByFood is not defined
So when I uncommented this part of the code:
//const findOneByFood = (food, //done) => {
//done(null /*, data*/);
//};
I was able to pass the tests
2 Likes
Ok, I will do it again.thanks a lot
I repeated the test many times and also uncommented the lines for const findOneByFood lines but still not passing. Please help. Thanks.
sitek94
5
The only thing I’ve changed in your code to make it pass the tests:
Code before
//const findOneByFood = (food, //done) => {
//done(null /*, data*/);
//};
Code after
const findOneByFood = (food, done) => {
done(null /*, data*/);
};
Very sad that when I am doing it after making above change , I am unable to pass.
That’s strange Can you send the error message that you’re getting and your most recent repl link?
latest repl link is:
https://repl.it/@meeramenon07/boilerplate-mongomongoose#.replit
error message:creating and saving a db item should succeed.(test timed out)
What about the errors in the console?
I was able to reproduce the same error:
Creating and saving a db item should succeed (Test timed out)
after I used wrong values in .env
file when setting up MONGO_URI
, so double check if everything is correct in your .env
file.
the console reads error as :
unhandled promise rejections mongooseErroe:'people.insertOne()
mongoose 'openUri() must be a string, got “undefined”
sitek94
12
It looks like it can’t get your URI string from .env file, hence this error:
mongoose 'openUri() must be a string, got “undefined”
Make sure that the variable name in your .env
file matches the one that you use in myApp.js
It has to be exactly the same:
// .env
MONGO_URI="..."
// myApp.js
mongoose.connect(process.env.MONGO_URI, {...});
finally I passed the test by uncommenting the people variables. cheers.
1 Like
system
Closed
14
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.