why mongoose is not connecting - node.js

node "c:\Users\muham\Coading 1\WEB DEVELOPMENT\MERN\SOCIAL-APP\server\index.js"
MongoParseError: Password contains unescaped characters did not connect
(node:7812) [MONGOOSE] DeprecationWarning: Mongoose: the strictQuery option will be switched back to false by default in Mongoose 7. Use mongoose.set('strictQuery', false); if you want to prepare for this change. Or use mongoose.set('strictQuery', true); to suppress this warning.
(Use node --trace-deprecation ... to show where the warning was created)
i had done with every steps ut still it's showing linke this

Related

i am using mongoose for first time and i dont know what problem is it showing . please anyone explain

(node:10348) [MONGOOSE] Deprecation Warning: Mongoose: the `strict Query` option will be switched back to `false` by default in Mongoose 7. Use `mongoose. Set('strict Query', false);` if you want to prepare for this change. Or use `mongoose. Set('strict Query', true);` to suppress this warning.
(Use `node --trace-deprecation ...` to show where the warning was created)
I can't understand so explain.

MongoDB not working properly , error shows in window with VS

[MONGOOSE] DeprecationWarning: Mongoose: the strictQuery option will be switched back to false by default in Mongoose 7. Use mongoose.set('strictQuery', false); if you want to prepare for this change. Or use mongoose.set('strictQuery', true); to suppress this warning.
(Use node --trace-deprecation ... to show where the warning was created)
Please help me out to get it resolve
Added deprecation warning https://github.com/Automattic/mongoose/pull/12675. Just add mongoose.set before your mongoose.connect to suppress the warning.
mongoose.set('strictQuery', true);
mongoose.connect(// codes)

gulp_jspm DeprecationWarning

When I use gulp_jspm I get this DeprecationWarning is there something else I should use to create my bundle files? When I used gulp-jspm-build I have to add some node files that I never had to do before.
Should I use gulp-jspm-build'?
Current versions:
node: v6.9.5
ts: 2.7.2
.pipe(gulp_jspm({
selfExecutingBundle: true
}),true)
(node:25936) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead. (Triggered by calling processImmediate on process.)
(Use node --trace-deprecation ... to show where the warning was created)
According to the author of gulp-jspm, it has not been updated or maintained since 2017.
https://github.com/brillout/gulp-jspm/issues/45

(node:52213) Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency (Use node --trace-warnings

What is meant by this?
(node:52213) Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:52213) DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version.
You can just ignore this warning for now,
look at this answer by Lauren_Schaefer which is a MongoDB Employee.
Link for the answer from the mongoDB developers community is here:
https://developer.mongodb.com/community/forums/t/warning-accessing-non-existent-property-mongoerror-of-module-exports-inside-circular-dependency/15411/6

Database is not running in mongodb atlas due to unhandled promise exception

My code is running fine in localhost with no warnings but when I'm changing my connection string to the string provided by mongodb atlas, following errors are showing which you can see in the below pic and my browser keeps circulating plz guide me what I'm doing wrong
(node:13700) DeprecationWarning: 'open()' is deprecated in mongoose >=
4.11.0,
use 'openUri() instead, or set the 'useMongoClient' option if using 'connect()' or 'createConnection()'. See
http://mongoosejs.com/docs/4.x/docs/connections.html#use-mongo-client
(Use 'node --trace-deprecation... to show where the warning was
created)
Server started on port 3000
Error [MongoError]: failed to connect to server [undefined:27017] on first connect [Error: getaddrinfo ENOTFOUND undefined
at GetAddrInfoReqwrap.onlookup [as oncomplete] (dns.js:67:26) {}] name: 'MongoError'
at Pool. (C:\Users\Umer\Desktop\node\Alhamdulillah, complete webapp\All Validations Completed\node_modules\mongodb-core\lib\topologies\server.js: 336:35)
at Pool.emit (events.js:315 :20) at Connection.
(C:\Users\Umer\Desktop\node\Alhamdulillah, complet e webapp\A11
Validations Completed\node_modules\mongodb-core\lib\connection\poo1
Lis:280:12)
screenshot
According to the problem that you're facing, it is because you're coding the deprecated method of connecting to the MongoDB.
Your database.js file seems okay but I would suggest that you use dotenv and not a separate file for your secrets
But in your app.js file, kindly completely change the way you're connecting to MongoDB.
const config = require('./config/database')
const options = {useUnifiedTopology: true, useNewUrlParser: true}
mongoose.connect(config.mongoURI, options).then(
()=> console.log('connected to mongodb'),
(reason)=> console.error(`Error: ${reason}`)
)
// All of your other code ahead.
Happy Coding!

Resources