Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Marshall Bradley](https://uploads.teamtreehouse.com/production/profile-photos/6261262/micro_IMG_0845.jpg)
Marshall Bradley
13,552 PointsI NEED HELP!!!! server port works but gettin error in console as well.. Deprecation Warning
please help asap.. getting error when running nodemon.. server port is working but wont save anything from form into database. here is the error
$ nodemon
[nodemon] 1.18.2
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node ./app
(node:944) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
Express app listening on port 3000
connection error: Error: Invalid schema, expected mongodb
or mongodb+srv
at module.exports (/Users/MarshB/UserAuthentication/node_modules/mongodb/lib/url_parser.js:21:21)
at deprecated (internal/util.js:47:15)
at connect (/Users/MarshB/UserAuthentication/node_modules/mongodb/lib/operations/mongo_client_ops.js:179:3)
at connectOp (/Users/MarshB/UserAuthentication/node_modules/mongodb/lib/operations/mongo_client_ops.js:283:3)
at executeOperation (/Users/MarshB/UserAuthentication/node_modules/mongodb/lib/utils.js:420:24)
at MongoClient.connect (/Users/MarshB/UserAuthentication/node_modules/mongodb/lib/mongo_client.js:168:10)
at Promise (/Users/MarshB/UserAuthentication/node_modules/mongoose/lib/connection.js:487:12)
at new Promise (<anonymous>)
at NativeConnection.Connection.openUri (/Users/MarshB/UserAuthentication/node_modules/mongoose/lib/connection.js:484:19)
at Mongoose.connect (/Users/MarshB/UserAuthentication/node_modules/mongoose/lib/index.js:229:15)
at Object.<anonymous> (/Users/MarshB/UserAuthentication/app.js:7:10)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
2 Answers
![Ari Misha](https://uploads.teamtreehouse.com/production/profile-photos/8488882/micro_Kik-507023765.jpg)
Ari Misha
19,323 PointsHello there! All I can say, from the error in your console, that There might be some syntax or Field error in your Schema. That's why it keeps saying Invalid Schema and won't let you add any entries in Mongo. Also, Deprecation Warning is something that you can ignore if you'd like to. But you're getting deprecation error coz you're using deprecated string parser lib/methods, you might wanna migrate to new URL string parser by mentioning { useNewUrlParser: true }
.
~ Ari
![Keegan Usher](https://secure.gravatar.com/avatar/e3365799ab147ce286ee8ff775d77f8d?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Keegan Usher
26,226 PointsHello,
Not sure if you got this error fixed yet. I added the "{useNewUrlParser: true}" option to the mongoose.connect line and the deprecation error stopped.
// mongodb connection
mongoose.connect('mongodb://localhost:27017/bookworm', {useNewUrlParser:true});
var db = mongoose.connection;
// mongo error
db.on('error', console.error.bind(console, 'connection error:'));
Hope this helps,
Keegan