Questions tagged [mongodb]

All versions of MongoDB - a scalable, high-performance, open source, document-oriented database.

Filter by
Sorted by
Tagged with
1
vote
1answer
663 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
7 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
314 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
75 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
23k 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
3 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 ...
-1
votes
1answer
46 views

What would be the best database for this set of environmental data? [closed]

Thanks for being out here. For educational purposes I want to create a website that queries a database of rising temperatures across the globe. The data can be seen here in an .xlsx format: Climate-...
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 ...
0
votes
1answer
28 views

what would be a good approach to loop through 100millions of mongo documents for deletion? [closed]

I need to do some cleaning of many big collection (90M documents each, about 8gb in size), where I would remove some of them based on rules. It's on a sharded cluster, each with 16gb of ram. This is ...
1
vote
0answers
9 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
21 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
158 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 ...
1
vote
1answer
32 views

What is the getdate() equivalent for MongoDB?

I have a query to update and set some values in some fields. Obut Now I need to update these field and in adition, I need to set DateOfModification to the current date and time. What is the equivalent ...
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
11 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
322 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
724 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
27 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
450 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
735 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
383 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
186 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
43 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
27 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 ...
0
votes
1answer
14 views

In MongoDB, $setIsSubset does not make efficient use of index

Data: student class s1 ["english"] s2 ["maths", "geography"] ... sN ["history", "english"] The field "class&...
0
votes
1answer
1k views

Query using $gte and New Date() working in MongoDB shell but not through python pymongo

When I run the following in the mongodb shell, it returns the correct number of records: (searching for the matching "SourceName" within the last 8 days) mongos> db.fdl.count({ SourceName : "SRC1"...
2
votes
2answers
579 views

creating replica set between three similar mongo databases on my local

I am creating MongoDB replication on local server by first manually creating three different databases folders with names like MongoDB, MongoDB1 and MongoDB2. Each one of them have data, bin and log ...
1
vote
1answer
28 views

Why aggregate query with lookup is extremely slow?

I have a mongodb query that works but takes too long to execute and causes my CPU to spike to 100% while it is executing. It is this query here: db.logs.aggregate([ { $lookup: { ...
1
vote
1answer
2k 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 ...
2
votes
1answer
624 views

Unable to connect to MongoDB replica set using public IPs

I have configured a three-node replica set in MongoDB. I am able to connect to each server and replication is in sync. But when I'm trying to connect to them as a replica set from a public IP, I am ...
1
vote
4answers
2k 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 ...
1
vote
2answers
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 ...
-4
votes
1answer
29 views

Doing query with website [closed]

I want to create a website and I have a data set of schools locations stored in Mongodb . There will be a search box on my website and when I search for the name of the school, I want to get the ...
5
votes
1answer
2k views

MongoDB - slow remove query

I have a collection in MongoDB with 800M+ records. I wanted to do some cleanup, but the remove operation is really really (unusably) slow - even deleting 1000 records can take 10+ minutes. The ...
4
votes
2answers
5k views

MongoDB restore with replica set

I have MongoDB setup like this: Primary | Server1 -----------+--------- Secondary | Server2 -----------+--------- Arbiter | Server3 -----------+--------- Backup | Server4 I ...

1
2 3 4 5
44