How to use mongoose with nodejs in codesandbox?

144 views
Skip to first unread message

Thug King

unread,
Nov 8, 2019, 2:01:41 AM11/8/19
to Mongoose Node.JS ODM
Actually the thing is i have been trying to work out the connection of the mongodb server in codesandbox as i am new to it and couldn't find anything?
when i run my app it shows error and Ibelieve that is due to the mongod command not running
and when i try to run the mongod command in the terminal it says that no such command exists?
PLS someone help me


this is the error i was talking about:
UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [sandbox:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND sandbox sandbox:27017]
    at Pool.<anonymous> (/sandbox/node_modules/mongodb/lib/core/topologies/server.js:431:11)
    at Pool.emit (events.js:198:13)
    at createConnection (/sandbox/node_modules/mongodb/lib/core/connection/pool.js:559:14)
    at connect (/sandbox/node_modules/mongodb/lib/core/connection/pool.js:973:11)    at makeConnection (/sandbox/node_modules/mongodb/lib/core/connection/connect.js:39:11)
    at callback (/sandbox/node_modules/mongodb/lib/core/connection/connect.js:261:5)    at Socket.err (/sandbox/node_modules/mongodb/lib/core/connection/connect.js:286:7)
    at Object.onceWrapper (events.js:286:20)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:687) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:687) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Here is a link to my project:

Richard Bateman

unread,
Dec 20, 2019, 2:14:52 PM12/20/19
to mongoo...@googlegroups.com
This is very much a codesandbox issue, not a mongoose issue. Mongoose is working fine but can't connect to the database -- looks like it's saying the hostname doesn't resolve.

The correct place to ask about this would be in their support forums.

Richard

--
Documentation - http://mongoosejs.com/
Plugins - http://plugins.mongoosejs.com/
Bug Reports - http://github.com/learnboost/mongoose
Production Examples - http://mongoosejs.tumblr.com/
StackOverflow - http://stackoverflow.com/questions/tagged/mongoose
Google Groups - https://groups.google.com/forum/?fromgroups#!forum/mongoose-orm
Twitter - https://twitter.com/mongoosejs
IRC - #mongoosejs
---
You received this message because you are subscribed to the Google Groups "Mongoose Node.JS ODM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-orm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongoose-orm/d683c28e-79a8-48fc-bcd1-29efc3ee1f8e%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages