mongodb-atlas

How to fix MongoError: Cannot use a session that has ended

折月煮酒 提交于 2020-02-04 12:10:20
问题 I'm trying to read data from a MongoDB Atlas collection using Node.js. When I try to read the contents of my collection I get the error MongoError: Cannot use a session that has ended . Here is my code client.connect(err => { const collection = client .db("sample_airbnb") .collection("listingsAndReviews"); const test = collection.find({}).toArray((err, result) => { if (err) throw err; }); client.close(); }); I'm able to query for a specific document, but I'm not sure how to return all

How to fix MongoError: Cannot use a session that has ended

ⅰ亾dé卋堺 提交于 2020-02-04 12:02:47
问题 I'm trying to read data from a MongoDB Atlas collection using Node.js. When I try to read the contents of my collection I get the error MongoError: Cannot use a session that has ended . Here is my code client.connect(err => { const collection = client .db("sample_airbnb") .collection("listingsAndReviews"); const test = collection.find({}).toArray((err, result) => { if (err) throw err; }); client.close(); }); I'm able to query for a specific document, but I'm not sure how to return all

How to fix MongoError: Cannot use a session that has ended

故事扮演 提交于 2020-02-04 12:01:59
问题 I'm trying to read data from a MongoDB Atlas collection using Node.js. When I try to read the contents of my collection I get the error MongoError: Cannot use a session that has ended . Here is my code client.connect(err => { const collection = client .db("sample_airbnb") .collection("listingsAndReviews"); const test = collection.find({}).toArray((err, result) => { if (err) throw err; }); client.close(); }); I'm able to query for a specific document, but I'm not sure how to return all

Mongoose is not connecting MongoDB Atlas

前提是你 提交于 2020-01-13 07:01:10
问题 This is the first time I use MongoDB Atlas to work with Mongo, and while trying to connect, that's the error I get: Error: connect ECONNREFUSED 3.209.60.172:27017 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14) { name: 'MongoNetworkError', errorLabels: [ 'TransientTransactionError' ], [Symbol(mongoErrorContextSymbol)]: {} } This is my code: const express = require('express'); const mongoose = require('mongoose'); const app = express(); mongoose.connect('mongodb+srv://johnnybox

MongoDB connection error: MongoTimeoutError: Server selection timed out after 30000 ms

笑着哭i 提交于 2020-01-10 19:46:30
问题 I am trying to create a fullstack app reading the following tutorial: https://medium.com/javascript-in-plain-english/full-stack-mongodb-react-node-js-express-js-in-one-simple-app-6cc8ed6de274 I followed all steps and then tried to run: node server.js But I got the following error: MongoDB connection error: MongoTimeoutError: Server selection timed out after 30000 ms at Timeout._onTimeout (C:\RND\fullstack_app\backend\node_modules\mongodb\lib\core\sdam\server_selection.js:308:9) at

Connecting to MongoDB Atlas from firebase functions

▼魔方 西西 提交于 2020-01-02 06:55:11
问题 I am trying to connect to mongodb atlas from firebase functions like. export default async () => { try { const url = 'mongodb+srv://foo:bar@foo-cluster.mongodb.net/my-db?retryWrites=true'; const client = await MongoClient.connect(url); client.dbName('my-db'); return client; } catch (e) { throw e; } } However, I am getting this error: { "code": "ESERVFAIL", "errno": "ESERVFAIL", "syscall": "querySrv", "hostname": "_mongodb._tcp.foo-cluster.mongodb.net" } I made sure that my firebase plan is

adding localhost to mongo atlas whitelist

别说谁变了你拦得住时间么 提交于 2019-12-24 05:01:10
问题 I've been using the option allow everyone connection to my atlas cluster by selecting the "Allow Access from Anywhere" button in the group IP whitelist. Is there a way to just add my localhost ip address instead. I tried doing it but I got the following error : /me/node_modules/mongodb/lib/replset.js:364 process.nextTick(function() { throw err; }) ^ MongoError: connection 4 to cluster0blbla.net:27017 closed Anyone know of a way to add localhost connection without opening security up to

adding localhost to mongo atlas whitelist

冷暖自知 提交于 2019-12-24 05:01:02
问题 I've been using the option allow everyone connection to my atlas cluster by selecting the "Allow Access from Anywhere" button in the group IP whitelist. Is there a way to just add my localhost ip address instead. I tried doing it but I got the following error : /me/node_modules/mongodb/lib/replset.js:364 process.nextTick(function() { throw err; }) ^ MongoError: connection 4 to cluster0blbla.net:27017 closed Anyone know of a way to add localhost connection without opening security up to

Couldn't connect to mongodb on mongodb-atlas

点点圈 提交于 2019-12-13 03:19:35
问题 Trying to connect to the mongodb free database on mongodb-atlas I've almost tried everything Checked the docs, Changed the url, Changing password and even deleted the user and created the new one but still not resolve the problem here is myurl.js file module.exports = { mongoURL: "mongodb+srv://nansDB:nansDB123@nodecluster-qs6cv.mongodb.net/test?retryWrites=true&w=majority", secret: "mystrongsecret" } here is my index.js file const express = require('express'); const mongoose = require(

Error: querySrv ENODATA _mongodb._tcp.blog-cluster-0hb5z.mongodb.net at QueryReqWrap.onresolve [as oncomplete] [closed]

有些话、适合烂在心里 提交于 2019-12-10 14:27:43
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed yesterday . It looks like I cannot connect to my free Mongo Atlas cluster anymore. Everything was working and I have data that was collected when I look at the MongoDB website so I have no idea why it stopped working and can no longer connect. My entire site won't load. This is there error I was getting: { Error: querySrv