mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-16 21:06:35 +08:00
fix(curriculum): Changed Mongoose version to avoid warnings in boilerplate's Node console when working on Mongoose challenges (#47129)
* fix: changed mongoose version to avoid warnings in console * fix: changed ~ to ^ for mongoose version Co-authored-by: Kristofer Koishigawa <scissorsneedfoodtoo@gmail.com> Co-authored-by: Kristofer Koishigawa <scissorsneedfoodtoo@gmail.com>
This commit is contained in:
parent
c17bd7cd89
commit
08ce28fba3
@ -22,7 +22,7 @@ Follow <a href='https://www.freecodecamp.org/news/get-started-with-mongodb-atlas
|
||||
|
||||
# --instructions--
|
||||
|
||||
`mongodb@~3.6.0` and `mongoose@~5.4.0` have been added to your project’s `package.json` file. First, require mongoose as `mongoose` in `myApp.js`. Next, create a `.env` file and add a `MONGO_URI` variable to it. Its value should be your MongoDB Atlas database URI. Be sure to surround the URI with single or double quotes, and remember that you can't use spaces around the `=` in environment variables. For example, `MONGO_URI='VALUE'`.
|
||||
`mongoose@^5.11.15` has been added to your project’s `package.json` file. First, require mongoose as `mongoose` in `myApp.js`. Next, create a `.env` file and add a `MONGO_URI` variable to it. Its value should be your MongoDB Atlas database URI. Be sure to surround the URI with single or double quotes, and remember that you can't use spaces around the `=` in environment variables. For example, `MONGO_URI='VALUE'`.
|
||||
|
||||
**Note:** If you are using Replit, you cannot create a `.env` file. Instead, use the built-in <dfn>SECRETS</dfn> tab to add the variable. <em>Do not</em> surround the values with quotes when using the <em>SECRETS</em> tab.
|
||||
|
||||
@ -34,27 +34,7 @@ mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true }
|
||||
|
||||
# --hints--
|
||||
|
||||
"mongodb version ~3.6.0" dependency should be in package.json
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
$.get(getUserInput('url') + '/_api/file/package.json').then(
|
||||
(data) => {
|
||||
var packJson = JSON.parse(data);
|
||||
assert.property(packJson.dependencies, 'mongodb')
|
||||
assert.match(
|
||||
packJson.dependencies.mongodb,
|
||||
/^\~3\.6\.0/,
|
||||
'Wrong version of "mongodb". It should be ~3.6.0'
|
||||
);
|
||||
},
|
||||
(xhr) => {
|
||||
throw new Error(xhr.responseText);
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
"mongoose version ~5.4.0" dependency should be in package.json
|
||||
"mongoose version ^5.11.15" dependency should be in package.json
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
@ -64,8 +44,8 @@ mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true }
|
||||
assert.property(packJson.dependencies, 'mongoose');
|
||||
assert.match(
|
||||
packJson.dependencies.mongoose,
|
||||
/^\~5\.4\.0/,
|
||||
'Wrong version of "mongoose". It should be ~5.4.0'
|
||||
/^\^5\.11\.15/,
|
||||
'Wrong version of "mongoose". It should be ^5.11.15'
|
||||
);
|
||||
},
|
||||
(xhr) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user