mongodb-atlas

Multi-Document Transactions not Working using MongoDB Atlas

别来无恙 提交于 2019-12-08 19:10:41
问题 UPDATE After some suggestions I modifies the code like this: const session = await mongoose.startSession() session.startTransaction() try { const udpated = await Schema1.findByIdAndUpdate( 'id', { $set: { /* ... */ } }, { session } ) const array = await Promise.all( updated.array.map(async item => { // change 1 const doc = await Schema2.findById(item.someId).session(session) const payload = { /* ... */ } // change 2 return new Schema3(payload).save({ session }) }) ) await session

Atlas MongoDB getting timeout occured after 30000ms when hosted ubuntu 16.04 LTS, using .Net mongodb driver

夙愿已清 提交于 2019-12-08 10:48:49
问题 From local system .NET standard 2.0 with mongo driver 2.7.3 connecting to Atlas mongodb and listing change stream working. When i deploy the same system on to ubuntu 16.04 LTS it is throwing below error. Connection string: mongodb://xxxxxx:xxxxx@mycluster-shard-00-00- xxxx.mongodb.net:27017,mycluster-shard-00-01- xxxx.mongodb.net:27017,mycluster-shard-00-02-xxxx.mongodb.net:27017/test?ssl=true& replicaSet=Cluster-shard-0&retryWrites=true Error: A timeout occured after 30000ms selecting a

Mongoose is not connecting MongoDB Atlas

只谈情不闲聊 提交于 2019-12-06 15:56:54
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:<password>@cluster0-cgxqx.mongodb.net/test?retryWrites=true&w=majority', { useNewUrlParser: true })

MongoDB Atlas Error while performing transaction on multiple collections (code 8000)

て烟熏妆下的殇ゞ 提交于 2019-12-06 00:46:42
问题 I'm trying to perform a transaction on a Mongo DB Atlas M0 instance from Mongo DB Node JS driver (as described here) and I'm getting the following error: code:8000 codeName:"AtlasError" errmsg:"internal atlas error checking things: Failure getting dbStats: read tcp 192.168.254.78:50064->192.168.254.78:27000: i/o timeout" message:"internal atlas error checking things: Failure getting dbStats: read tcp 192.168.254.78:50064->192.168.254.78:27000: i/o timeout" name:"MongoError" I've been

Mongodb Atlas: not authorized on admin to execute command

纵饮孤独 提交于 2019-12-05 14:13:58
问题 I have a MongoDB Atlas cluster within which I am trying to simply copy a database within the same instance. Unfortunately, every time I try to run db.copyDatabase() or copydb admin command, I get the following error: not authorized on admin to execute command Which is very strange, because I just have one user, and it has access to everything, at least as far as I can tell on atlas: I did some search in stackoverflow, but it looked like most of the answers pertain to mongod instances running

Accessing a MongoDB Atlas Cluster from within Google Cloud Functions Console

北城余情 提交于 2019-12-05 11:57:42
I'm writing a basic Google Cloud Function that is going to query a MongoDB Cluster from MongoDB Atlas. I'm writing inside the Google Console and I was sure to add "mongodb": "^3.0.2" to the dependencies in the package.json file. Here's the function (I replaced the valid password, etc. in the uri for security): /** * Responds to any HTTP request that can provide a "message" field in the body. * * @param {!Object} req Cloud Function request context. * @param {!Object} res Cloud Function response context. */ exports.myPackage = (req, res) => { var MongoClient = require('mongodb').MongoClient; var

Error at connecting to MongoDb Atlas Server

感情迁移 提交于 2019-12-04 10:24:16
问题 So I'm currently wirting a web application and I need database so I decided to go with mongodb and mongoose. Until now I tested everything on localhost and it worked but I wanted to move the data to a server. I had heard of Atlas and registered myself and "uploaded" the data. Now I want to connect to the cluster via a node.js app. mongoose.connect('mongodb+srv://engllucas:p%40ssw0rd@insight-quhku.mongodb.net/test'); I got the string of the mongodb Atlas site at the point Connect Your

MongoDB Atlas Error while performing transaction on multiple collections (code 8000)

橙三吉。 提交于 2019-12-04 05:58:34
I'm trying to perform a transaction on a Mongo DB Atlas M0 instance from Mongo DB Node JS driver (as described here ) and I'm getting the following error: code:8000 codeName:"AtlasError" errmsg:"internal atlas error checking things: Failure getting dbStats: read tcp 192.168.254.78:50064->192.168.254.78:27000: i/o timeout" message:"internal atlas error checking things: Failure getting dbStats: read tcp 192.168.254.78:50064->192.168.254.78:27000: i/o timeout" name:"MongoError" I've been searching for a while now and can't find any clue on how to solve this. Aditional information: The error is

Mongodb Atlas: not authorized on admin to execute command

狂风中的少年 提交于 2019-12-04 00:41:10
I have a MongoDB Atlas cluster within which I am trying to simply copy a database within the same instance. Unfortunately, every time I try to run db.copyDatabase() or copydb admin command, I get the following error: not authorized on admin to execute command Which is very strange, because I just have one user, and it has access to everything, at least as far as I can tell on atlas: I did some search in stackoverflow, but it looked like most of the answers pertain to mongod instances running locally, and not ones running in atlas... Did I setup the user wrong? I ended up asking this question

How to use new URL from mongodb 3.6 to connect from golang

给你一囗甜甜゛ 提交于 2019-12-03 18:13:43
问题 I tried to connect to mongodb Atlas using golang drivers. tlsConfig := &tls.Config{} var mongoURI = "mongodb+srv://admin:password@prefix.mongodb.net:27017/dbname" dialInfo, err := mgo.ParseURL(mongoURI) if err != nil { panic(err) } dialInfo.DialServer = func(addr *mgo.ServerAddr) (net.Conn, error) { conn, err := tls.Dial("tcp", addr.String(), tlsConfig) return conn, err } session, err := mgo.DialWithInfo(dialInfo) if err != nil { println("error") log.Fatal(err) } _ = session c := session.DB(