Questions tagged [mongodb]
All versions of MongoDB - a scalable, high-performance, open source, document-oriented database.
2,180
questions
0
votes
1answer
473 views
how mongo db does locking for updates/inserts?
I have many data for each user that with write heavy and many for each separate users that there is not any relation between user's data; so there is two options for me to store them:
1. keep all user'...
2
votes
1answer
1k views
Merge 2 mongodb databases
Our team have hard time. Situation:
API went down, all infrastructure (API + MongoDB) terminated.
We restore API and mongodb (data restored from backup).
After a while (let's say 1 day) we discovered ...
1
vote
1answer
698 views
Connection string for connecting mongo database with SSL enabled
Am facing some below problem in my mongodb replication environment
I have 3 replica set environment with SSL enabled and ssl mode as preferSSL
3 servers has 3 different Key file with common CA file
...
1
vote
1answer
2k views
duplicate key error index MongoDB
I have rocket.chat server connected to LDAP.
When one of users try logging to their account he get logged to someone other account, it's probably because indexes. My logs look like this:
[...
0
votes
2answers
3k views
join two collections with group by and sum in Mongodb
i have this two collection and i want to join, after this I want to sum the value of TotalPrice each orderdate :
some line of my two collections
the first collection date :
{"Id_Date":1,"...
1
vote
1answer
19 views
Efficient way to get data for each date range intervals using single query | MongoDB
I have collections about products and purchases. I need to get statistics for each time interval.
I need following:
Name
quantity (date 1 range)
quantity (date 2 range)
Name One
500
400
Name Two
...
0
votes
1answer
681 views
mongodb crashed with the error or permission denied
Our mongodb server was running for the last two months without any error. Suddenly it crashed and below is the log.
2017-08-11T13:41:41.320+0100 E STORAGE [thread1] WiredTiger (13) [1502455301:...
1
vote
2answers
569 views
mongo primary is showing behind the primary?
mongo primary is showing behind the primary ?? Its increasing as time passes . Please suggest ?
monRepl:PRIMARY> rs.printSlaveReplicationInfo()
source: xxxxxx:27017
syncedTo: Mon Apr 27 2015 ...
5
votes
2answers
3k views
How do long string field names affect MongoDB database size?
I am using MongoDB and the names of my fields are strings with 10-20 characters. A typical document consists of 30.000 columns filled mostly with floats, like 1.2, 10.5, 2.55. It's size is 1MB.
Do ...
1
vote
1answer
45 views
MongoDB + Compass exporting strings and numbers “columns” with value of 1 as “true”(boolean) and 2 or null as “false” to CSV
When I export my MongoDB collection to a CSV, the String and Number "column" data types values are converted to "true" for 1 and "false" for 2 and null - how do I retain ...
0
votes
0answers
21 views
Mongo Atlas connection error type=UNKNOWN, state=CONNECTING
Yesterday I've seen some strange behavior that my application can't connect to Atlas.
This has never happened before for about 1 year, and there was no application deploying going on.
The error that ...
3
votes
1answer
389 views
Mongo WriteConflictException in log file
I am experiencing ALOT of this WriteConflictException in my mongo log file, this does not seem to affect the application, because I am not seeing any special errors and everything seems to work fine.
...
0
votes
1answer
2k views
MongoDB 3.6 crashed due to invariant() failure
MongoDB crashed twice in 6 hours today due to invariant() failure. We have been using MongoDB 3.6.3 for more than a year now, but this is the first time that we saw this issue. The extract from the ...
2
votes
1answer
728 views
MongoDB: Mongoimport server selection error , connection refused, too many files open
Trying to insert several JSON files to MongoDB collections using shell script as following,
#!/bin/bash
NUM=50000
for ((i=o;i<NUM;i++))
do
mongoimport --host localhost --port 27018 -u 'admin' -...
1
vote
1answer
677 views
MongoDB 3.6 create local Shard db without replica
This is what I want to do:
Create a Config Server
Create 2 Shard
Create a Mongos Router
I don't want to replicate my data using replica set, I want to simulate that each shard has only a part of ...
0
votes
0answers
27 views
MongoDB 3.6.21 crash and not reIndex
I try to reIndex() my collection but not working and It removed all indexes. I checked mongod.log and see:
2021-01-18T05:56:59.492-0600 E STORAGE [conn1] WiredTiger error (5) [1610971019:492802][...
1
vote
1answer
328 views
MongoDB specifying shard key and sharding strategy
What is the syntax to state that a collection is to be sharded as location based, while using the range based sharding strategy. I know you have to use the the sh.shardCollection() command, but what ...
0
votes
1answer
134 views
UserNotFound mongodb error
I know there are lot of articles with the same issue and I explored every other article trying everything and still this error persists.
Here are the steps I followed:
use admin.
created an admin ...
1
vote
2answers
1k views
Copy Specific Columns from DB 1 To DB 2 on MongoDB
I have Two Instance of Node JS server which is handled By NGINX. First server is connect with MongoDB First Server i.e
mongoose.connect('mongodb://127.0.0.1/db_primary', { useMongoClient: true });
...
1
vote
1answer
1k views
Mongodb: Determining shard key strategy on compound index
I have a collection with 170 millions+ documents and it is only going
to increase. The size of the collection is not that huge, currently
around 70 GB.
The collection has two fields indexed on: {...
0
votes
0answers
6 views
Rotating MongoDB Replica Set Internal Auth Certificate Authority
I noticed that for replica set internal authentication all MongoDB instances must have certificates signed by the same CA. (Source)
Rotating individual certificates is sensible, but if I wanted to ...
5
votes
1answer
2k views
Mongodb crash after WiredTiger Cannot allocate memory error
I am using MongoDB (3.2.6) as storage for my application and since a couple of weeks MongoDB started to crash usually every 1 or 2 weeks. The crash seems to come from an issue during WiredTiger memory ...
0
votes
1answer
1k views
Could not add Replica Set to MongoDB Shard
I want to deploy a MongoDB Cluster for testing on 3 Virtual Machines using Docker.
On the first Virtual Machine I have the Router Instance and a Replica Set of the 3 Config Servers.
The second ...
6
votes
1answer
7k views
Restore mongoDB by --repair and WiredTiger
We accidentally deleted the directory rm -rf /data/db
which was our MongoDB path, and thanks to
extundelete, we recovered it and got the directory /data/db.
Here are our files in the directory, and ...
0
votes
1answer
1k views
Mongo DB sharded cluster fails when one shard is down
I am using Mongo Sharded cluster with two shards.
There was an issue on my one shard and and it was down for around 30 minutes.
It stopped my writes to other shards also.
Logically if one shard is ...
7
votes
4answers
24k views
How to keep Mongodb log small via the conf file (or other persistent method)
This is related to my question in stackoverflow where vb.net simply hang on updating a mongodb query.
https://stackoverflow.com/questions/12780258/insert-mongodb-using-vb-net/12796593#12796593
After ...
0
votes
0answers
5 views
MongoDB numerous slow query logs with zero keysExamined
using a MongoDB version 3.6 Replica Set, I am wondering why a query that resulted in no key examination and document examination would result in being slow. For example, I have numerous slow query ...
0
votes
1answer
13k views
MongoDB - Mongoose query findOneAndUpdate() doesn't update/duplicates the DB
I am trying to save and update (upsert: true - creates the object if it doesn't exist) the result of the Web Api which contains multiple arrays of data to populate the stock chart. Each time I enter a ...
1
vote
0answers
11 views
Want to add more options on User database schema to premade users
So I have this User MongoDB Schema, and I want to add other options to it. but if I do then the current users have to create a NEW Account to see the new changes. is there a way to update all the ...
0
votes
1answer
27 views
show users doesn't show anything, although it has users
So I'm using MongoDB, and this is my first time dealing with a VPS on my own, I'm trying to view the users i have on the website. I know for a fact that there are signed up users, because I can signup ...
2
votes
1answer
169 views
MONGOS uselessly scanning indexed documents when counting on shards
I have a simple collection with 40M documents distributed over 2 shards. The documents contain a field named COUNTRY with a sparse index on it.
db.contacts.count({ "COUNTRY": "US" })
I am trying to ...
1
vote
1answer
5k views
Aggregation vs Cursor For Reshaping MongoDB Documents
I'm looking to reshape the Documents in one of my collections, and have found two ways to do it, but need guidance. For simplicity, say I have a collection, "myColl", and I need to reshape Documents ...
0
votes
1answer
1k views
Clean up orphaned documents in MongoDB
Currently we have a 4 shard cluster
Can you give me the procedure to check the orphaned documents in our cluster
And can you provide me the procedure to delete the orphaned documents in the cluster
...
4
votes
3answers
9k views
Close MongoDB dead connections
I have a script that connects to my local mongos and do some processing. However, during the process, I encountered many cursor timeout exceptions, which (I suspected) left many dead connections on my ...
2
votes
1answer
3k views
Read concern level of majority error while upgrading Sharded Cluster from 3.2 to 3.4
I have upgraded MongodDB sharded cluster having two replica sets from 3.2 to 3.4. Current storage engine is MMAPv1. After successfully upgrading all the secondary, primary, config server and mongos to ...
0
votes
0answers
12 views
Why is my mongodb setup not reaching EBS IOPS limit?
I have an application that is constantly pumping data to MongoDB. MongoDB instance is running with 2-replicas, each with 3TB gp2 EBS volume.
As you can see on the following graph of
irate(...
0
votes
1answer
352 views
MongoDB 4.2 using change streams with read concern majority disabled in a PSA deployment
I currently run a PSA (Primary, Secondary, Arbiter) deployment and thous only have two databearing nodes.
In case of a databearing node going down, read concern majority prevented the change stream to ...
1
vote
1answer
728 views
Replication priority
I have two MongoDB instances running on two servers (instance1 and instance2) and they are configured as a replica set. Instance1 is the primary and instance2 is the secondary.
When instance1 was ...
1
vote
1answer
53 views
Not able to connect to Mongodb vie mongo shell
I am no able to connect to mongodb via mongo shell.
command:
sudo mongo --tls --tlsCertificateKeyFile server.pem --tlsCAFile CA_INTERMEDIATE --host "mongodb://xxx:xxx@some-url:27020/data_base?ssl=...
0
votes
1answer
3k views
Insert on duplicate key update using MongoDB
Can somebody tell me how I should build MongoDB "updateOne" query to get analog of the following SQL query:
INSERT INTO `collection`
(`hash`, `total`, `base_fare`)
VALUES ('aaa', 200, 150)
ON ...
3
votes
1answer
3k views
How to improve performance of this aggregate query? [closed]
I have the following tables in MongoDB:
Users table (count 200+ users):
{
"_id" : ObjectId("56dd6204ce47a3c44d8b4567"),
"u_role" : "1",
"u_fname" : "dsfsd",
"u_lname" : "dsfdsf",
"u_email" : "dsfds@...
0
votes
1answer
511 views
High CPU usage on fresh new install of MongoDB
I read a lot of post about high CPU usage of Mongo but almost all relates to queries.
I just did a fresh install of MongoDB 4. I have no other databases than the default one.
As soon as I start the ...
3
votes
2answers
8k views
mongo replicated shard member not able to recover, stuck in STARTUP2 mode
I have following setup for a sharded replica set in Amazon VPC:
mongo1: 8G RAM Duo core (Primary)
mongo2: 8G RAM Duo core (Secondary)
mongo3: 4G RAM (Arbiter)
mongo1 is the primary ...
1
vote
1answer
770 views
Service Discovery for MongoDB
What is the best way of implement a Service Discovery like ETCD for use in a mongodb cluster? I wish have, 1 master for HA and two nodes, in my master i have a static ip, but nodes maybe can changes ...
0
votes
2answers
405 views
Mongodb shard balancing failed
Data balancing fails on Mongo cluster with 1 mongos and 3 mongod instances. All the data for the collection fs.chunks stays in the same shard with the following error.
Env: Ubuntu- AWS m3.large,
...
0
votes
1answer
117 views
Mongoimport monitoring successfully entered row/data
How to monitor mongoimport hass successfully saved data into our database? Let's say I have 20,000 rows of CSV data. When I press the button to start mongoimport, the user will see the progress.
Is ...
2
votes
1answer
194 views
MongoDB stale replication, odd timestamp after data flush
Right before my secondary goes stale, it first has this written in the log:
2017-04-25T06:48:02.991+0000 I STORAGE [DataFileSync] flushing mmaps took 13530ms for 3150 files
Then it gives me a odd ...
2
votes
2answers
3k views
How do i copy my mongodb data-files to mongodb server
I actually copied above two files in MongoDB's data folder which is default in windows machine (C:\data\db ). But when I start mongo shell and type show dbs, it will not show my database.
Steps I ...
0
votes
2answers
50 views
MongoDB covered query needs to fetch and examine documents when exists operator is used
I need to execute following query on mongo db:
db.testCollection.find({ dataType: { $exists: true } }, { _id: 0, date: 1 })
.sort({ date: -1 })
.limit(1)
so basically only I need to do is to ...
0
votes
1answer
41 views
Read Concern Majority when majority nodes are down
I have a 6 node replica set (all of them data bearing) with 5 voting members. If I lose 3 voting members, I will not have a majority voting members and my replica set will become read-only.
In this ...