Questions tagged [mongodb]
All versions of MongoDB - a scalable, high-performance, open-source, document-oriented database.
2,341
questions
5
votes
1
answer
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
2
answers
982
views
Mongodb users in replica
1) I have mongo instances A, B and C, each having a different set of users with different roles. I have used mongo shell to connect with A through an Admin user. Now, to create a replica and add B and ...
0
votes
1
answer
497
views
secondaries not replicating data from primary due to some HMAC issue
Has anyone faced this issue ? Unable to re-sync replication either deleting the data directory & starting or doing rsync. Is this a bug ? What component in mongodb this "monitoring-keys-for-...
0
votes
0
answers
7
views
MongoDB Container Connection Hangs with no Response
This is my first time trying MongoDB. I'm just trying to simply connect to it successfully. I'm following the W3 tutorial here: https://www.w3schools.com/nodejs/nodejs_mongodb.asp
docker-compose....
3
votes
2
answers
4k
views
How do I copy my MongoDB data files to a new server?
I copied the two files in MongoDB's data folder, which is default in Windows machine (C:\data\db), but when I start the mongo shell and type show dbs, it will not show my database.
Steps I followed is ...
1
vote
1
answer
909
views
Rotate Logs in a MongoDB Replica Set installed in Windows Server
I have a Replica Set with 3 MongoDB installed in Windows 2012 Server by using a configuration file through Windows Services.
Here is my mongod.cfg
storage:
dbPath: E:\MongoDB\data
...
3
votes
1
answer
712
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.
...
1
vote
1
answer
487
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
1
answer
631
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 ...
0
votes
2
answers
555
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,
...
2
votes
4
answers
4k
views
MongoDB: Server sockets closed after a few minutes
I am working with multiple AWS intances connected to the same MongoDB database (inside Compose.io Elastic deployment). But i am getting the error server <url>:<port> sockets closed after a ...
0
votes
1
answer
594
views
Mongodb index keeps growing in size eventhough the collection has a TTL index
I work on a mongodb sharded cluster (3.0.2 i know it's very outdated, not my call), on which i have a sharded db and a sharded collection on which i have multiple indexes.
One of the indexes is a TTL ...
0
votes
1
answer
20
views
Shard queries timing out - Sharding status not available
Queries to one of our shards are regularly timing out with the following error:
“sharding status of collection db.collection is not currently available for description and needs to be recovered from ...
2
votes
1
answer
256
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 ...
0
votes
1
answer
933
views
MongoDB in M1 Mac: 'mongod' command doesn't work
I'm totally new to mongodb and has no knowledge about it at all.
So I just followed installation guides in the internet, but after installation 'mongod' command doesn't work and shows these lines...
{&...
1
vote
2
answers
2k
views
how to run mongo export on macbook?
I am using mongodb Atlas (M0), which does not provide db backup feature. I am creating a nodejs script that will export all the collections automatically periodically.
So far I have done the following:...
0
votes
1
answer
5k
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 ...
1
vote
1
answer
758
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
1
answer
4k
views
How to repair mongodb collection when index is corrupt?
Mongo version: 2.6 I think one or more of my MongoDB index is corrupt which is not letting me delete the corrupt collection or make a backup with mongodump
Below is the error i get when i try to ...
0
votes
1
answer
345
views
optimized query mongo find
I want to fetch all data from a collection. Since running just find({}) crashes the mongo container (the liveness probe seams to fail because k8s reboot the container), I ask myself if using skip/...
0
votes
1
answer
1k
views
How is the MongoDB backup snapshot transferred from Ops Manager to file system store?
I am using Ops Manager for backup and restore.
In docs, it is mentioned that the initial sync between deployment database and Ops manager happens via streaming 10 MB compressed files.
https://docs....
5
votes
3
answers
10k
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 ...
1
vote
1
answer
3k
views
Is mongodb upsert the right option for write intensive use case?
I'm designing a data model for a transactional use case which is write intensive. The write load would be 900 - 1,600 Transactions Per Second (TPS) which would account for 30 million Inserts/Updates ...
2
votes
1
answer
2k
views
Progress of mongodump operation jams at a random point
We are executing remote mongodumps to backup collections. For some time now sporadically one of these dumps stops to progress any further and remains to log out the same amount of documents processed ...
0
votes
1
answer
840
views
How to access two different databases with different admin databases in MongoDB that are hosted on the same server
I have 2 databases. Suppose first DB is X and second DB is Y. X has its own admin DB and Y has its own admin DB. Both X and Y are hosted on the same server.
I want to pull out data from both the DB's ...
0
votes
1
answer
3k
views
How can i convert all object Ids to string using query in MongoDB, note the structure is complex, So can't use $toString in $addFields and $project?
I have a really deep-nested JSON object generated by aggregation query, but I want to convert all the object ids to string format. Tried $toString in $addFields and $project. Since the object is ...
0
votes
2
answers
588
views
Mongodb chunksize issue
I have a collection which have size : 60 GB
I want to shard this collection. Shard key is hash index and unique.
I followed this document https://docs.mongodb.com/manual/reference/limits/#Sharding-...
2
votes
2
answers
1k
views
Automatically updating a record using count() of another collection
I have been looking at the docs and searching for videos on my problem, but I find nothing. I have a db called HPDASH where I have 2 collections, scripts and serverList. My problem is that I want to ...
0
votes
1
answer
709
views
Mongodb Index not used in case of $or query
I have added created a collection first
and created index
db.first.createIndex({a:1, b:1, c:1, d:1, e:1, f:1});
and inserted data
db.first.insert({a:1, b:2, c:3, d:4, e:5, f:6});
db.first.insert({a:...
1
vote
1
answer
609
views
Error while doing in replicaset in windows (MongoDB)
I tried doing the replicatset in windows, but im getting the below error. I checked the mongo process and killed the existing process. Even though the error exists.
help me on this pls
Thx
...
0
votes
1
answer
439
views
How to use mongoexport in count?
I want to get the count of all rows in a single collection into an output file. What is the correct way of doing this
Here is what I did but I am encountering an error.
mongoexport --host 10.1.0.1:...
0
votes
1
answer
2k
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
1
answer
2k
views
Mongo replication lag slowly increasing
I am running a replica-set in production with slaveOk = false using mongo 2.0.7 in AWS The replication lag on one of the servers is close to 58 hours. This replication lag is sometimes decreasing ( at ...
0
votes
0
answers
10
views
mongodb sharding error
Does anyone can help?
Mongdb sharding in v4.2 raise error:
2023-05-14T00:08:14.765+0000 E QUERY [js] uncaught exception: Error: error: {
"ok" : 0,
"errmsg" : "...
0
votes
0
answers
51
views
Interaction between ReadConcern and ReadPreference in mongodb
Question 1. Is my understanding of the concepts correct?
ReadConcerns:
local - returns data from any single instance, and thus may return outdated state, or state that will be rolled back.
majority - ...
0
votes
0
answers
22
views
how to build "mongos" server in mongodb for sharding?
I have searched "how to build a mongos server in mongodb" because I am building a simple sharding system locally. No I want to use the "addShard" function. It seems it would be the ...
0
votes
1
answer
255
views
Running Aggregation logic on multiple shards of MongoDB
Suppose we have 5 shards in MongoDB having collection of data, and I have to write an Aggregation logic which should work on each of 5 shards in my cluster and collect data from these shards. Should ...
3
votes
2
answers
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 ...
0
votes
0
answers
30
views
unable to perform mongodb oplog recovery
I've taken a oplog backup after the timestamp 1683598975 using below mongodump command on node server.
mongodump -u username -p password --host=server --port=8303 -d local -c oplog.rs --oplog --...
1
vote
1
answer
1k
views
Mongo 3.2.20 Invalid access at address
My mongodb local instance just crashed on its own with the following in its log:
Invalid access at address: 0x18
Got signal: 11 (Segmentation fault).
Environment:
Ubuntu 16.04
MongoDB v3.2....
0
votes
1
answer
716
views
MongoDB: F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/data1/mongodb/log/mongod.log"
I am trying to install mongodb 3.4 on Redhat 7.9. When I start mongodb systemctl start mongod I get the below error FileNotOpen: Failed to open "/data1/mongodb/log/mongod.log, But when I start ...
0
votes
1
answer
325
views
MongoDB secondaries become unresponsive during replication
We got 3 Servers running. One Primary, two as secondaries. Primary has 4 vcpus, 16 GB memory, both secondaries have 8 vcpus, 64 GB memory.
Every night, we run a full sync with several large ...
1
vote
2
answers
4k
views
Mongo exception: connect failed on reboot
I have Mongo installed on Ubuntu 16.04 machine, on VMWare. I start it using "mongo" command, last week there was no problem. But recently, it gives this error:
MongoDB shell version: 3.2.15
...
0
votes
2
answers
960
views
How to find documents that is equal or includes today in its date range?
Given the date, how can I find and return only documents that are in the range or equal to the start or end date in Mongo DB?
"startDate" : ISODate("2020-01-01T00:00:00.000+0000"),
"endDate" : ...
1
vote
1
answer
387
views
what will happen if MongoDB primary host is down and secondary is out of sync. will we lose transaction?
In our environment, we have one primary(A) and two secondaries(B & C nodes) running in Mongodb 4.0 version. secondary(C) server is newly added and sync is happening on that. Cluster is running ...
4
votes
1
answer
1k
views
MongoDB can't add new replica set member [rsSync] SEVERE: Got signal: 6
I have a replica set and I added a new member to the set. The initialSync begins for the new member and rs.status (on primary) shows STARTUP2 as status. However, after a long enough time, there's a ...
1
vote
1
answer
708
views
Consequences of increase Oplog to large size
I'm trying to add a new member (m*-server: 4.2.7) in my replica set (m*-servers: 4.2.1),
and it can't sync in time, after the initial sync it changes state to RECOVERING and have: (~ 4.3 - 6.31 hrs) ...
0
votes
1
answer
522
views
Mongo slow startup after upgrade to 4.2.5
I have upgraded the MongoDB replica set, which consists of 3 members, from 4.0.11 to 4.2.5.
After upgrading, startup lasts about 5 minutes.
Before upgrading it was instant.
It is related to ...
1
vote
1
answer
579
views
MongoDB Unrecoverable Failure
My machine (OSX) had a power failure and when restarted, I have one db in MongoDB that is completely unrecoverable. I am using the db per directory with dbpath and logpath specified options and was ...
0
votes
0
answers
17
views
Query that accesses 2 feilds of document in collection
I have a users collection of documents containing fields city_name, and income. How can I write a query which gives me the documents data of the top 10 cities which have the highest number of users ...