Questions tagged [mongodb]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
177 views

Switching from 2 large collections to multiple small ones in MongoDB 3.4

I know this question is similar to other ones. But... Only that we are switching from 2 very large collections (15Gb in size, constantly growing). Basically those 2 large collections keep different ...
0
votes
2answers
461 views

Handling Bus Error in Mongo Service

I have a Mongo service with which multiple hosts are interacting. The host on which the Mongo service is running is quite special -- it has 3TB of RAM. However, that host also throws intermittent Bus ...
1
vote
2answers
1k views

Unable to connect to mongodb

I am trying to connect to mongodb and querying data from it. Here is what I am doing: In node js my db connection file is looks like this: //Using mongodb drivers has to be installed using npm var ...
1
vote
1answer
465 views

What is mongodb logging as a COMMAND?

Relating to mongodb's documentation, database commands such as count will be logged as component COMMAND. However neither db.count() nor db.runCommand({count:'mycollection'}) produces a COMMAND log ...
1
vote
1answer
208 views

Import indexes from MongoDB v2.4 to MonDB v3.6.4

I have migrated the collection.bson file from MongoDB 2.4 to MongoDB 3.6.4 as collection.json. But their is 1 more file collection.metadata.json in MongoDB 2.4. How can I import this to MongoDB 3....
0
votes
1answer
159 views

ADD new node Replication in MongoDB

Here i found some trouble. and i don't known why! Now I have one replication with 3 members (1 of primary, 2 of secondary), And i want to add another one (secondary) to sync the data. the data has ...
0
votes
2answers
21 views

Significance of $$ in MongoDB

I was recently given this snippet of code that generates an arbitrary document in MongoDB. I've never encountered $$ in Mongo before and I'm curious about its significance. All I know is that if I run ...
0
votes
0answers
8 views

Query trajectories that intersect two regions in pymongo

Consider a MongoDB where each document corresponds to a spatial trajectory. That is, there is a field that contains an array for each document. Each array is a sequence of latitude/longitude pairs ...
1
vote
1answer
237 views

MongoDB Shard distribution issue

I am facing an issue in the shard distribution. MongoDB Version: 3.0.15 I have a collection that is sharded. I have two shards. Output of db.getCollection('event').stats() { "sharded" : true, "...
0
votes
0answers
7 views

Failed global initialization: FileRenameFailed: Could not rename preexisting log file

I get this error while trying to launch mongo deamon. CONTROL [main] Failed global initialization: FileRenameFailed: Could not rename preexisting log file "/var/lib/mongodb/log/mongod.log" ...
0
votes
0answers
33 views

How to specify a sync source when adding a new member to a MongoDB replicaset?

Recently we had a machine physically destroyed, so our replicaset is now: Primary - Secondary - Arbiter (250G on disk, 20G (70hrs) oplog). So, I'm trying to add a new member (4.4.10) to the replicaset ...
1
vote
1answer
357 views

Why findOne() hangs on a sharded collection?

A MongoDB v3.6.4 database with a large sharded collection and WiredTiger engine hangs when issuing a findOne() or find() command without any parameters. The collection has only the default index on ...
0
votes
1answer
90 views

Configure mongo for one shot full db read

I have a kubernetes cluster on bare metal with 3 machines having 8Gb of ram each. All my apps and a mongodb 4.0.9 replicaset runs on it. There is an import program that: Download a 8Gb mongo dump ...
1
vote
1answer
3k views

MongoDB merge two collections and drop documents with same value in field

In my database I have two collections, but some documents were added (possibly) at different times to both collections. I could use mongodump and then mongorestore for merging. But then I have the ...
0
votes
2answers
2k views

mongodb conf node won't start - compatibility error

I recently upgraded a dev sharded-cluster from 3.6 to 4.0 - one of the conf servers is now failing to start: 2020-01-30T13:19:02.972-0600 F CONTROL [initandlisten] ** IMPORTANT: UPGRADE PROBLEM:...
1
vote
1answer
151 views

create mongodb user to only read in replica set (not in master)

We have a Mongodb with ReplicaSet and a readonly user. This user can read from both Master and Replica Set. Some of the developers might accidentally run heavy queries from Master with this readonly ...
0
votes
1answer
13 views

Mongo node with smaller priority has not stepped out

I have a three nodes replica and I prefer a 10.0.0.5 as a primary. I have just realized during a performance test that 10.0.0.2 is primary instead. I thought it should have step out automatically ...
0
votes
0answers
22 views

MongodB CPU and memory utilization is low yet queries taking time to execute

I have 3 replica set instances running on different machines. Primary has CPU utilization of 20% and memory usage of 50% yet sometimes there are spike in in random queries which takes several seconds ...
0
votes
1answer
144 views

Why does a query on a sparse index perform much faster than a query on a partial index in MongoDB?

I created a sparse index in my MongoDB Atlas like so: db.detection_events.createIndex({"emp_id": 1}, {sparse: true}) When I performed this operation: db.detection_events.count({"emp_id": {$exists: ...
0
votes
1answer
110 views

The reading with secondaryPreferred when chunk migration occurred often fail

We have some problems regarding balancer configuration. Our application which is set up with secondaryPreferred often fails to read documents from the secondary when balancer( chunk migration ) is ...
1
vote
1answer
500 views

mongodump: fact.bson: input/output error

We are trying to export 1.5TB database into mongodb. But its fail after 100gb and giving us below error. As we notice root mount point got 100% space. We are using below command: mongodump -u admin -...
0
votes
2answers
14 views

can we use one arbiter server in two different replica sets of MongoDB?

can we use one arbiter server in two different replica sets of MongoDB? I had one replica set with one master one slave and one arbiter server so want to use the same arbiter server in another replica ...
0
votes
1answer
20 views

Unable to join arbiter to a replica set

I'm trying to add a arbiter to replica set. Unable to join arbiter to a replica set. port is listening - netstat -an | grep PORT tcp6 0 0 :::PORT :::* ...
3
votes
2answers
1k views

How to promote hidden mongo node to primary?

We are trying to implement DR setup for our mongodb replica set and currently three nodes in DR are configured to run as hidden nodes. We are trying to test failover to DR which will require promoting ...
0
votes
1answer
92 views

Multi-tenant reduce number of MongoDB connections

Our multi-tenant app has about 4000 databases per tenant and we are having a problem with performance because of too many connections. Creating MongoDB connections on each database is a heavy ...
0
votes
1answer
11 views

MongoDB TLS unable to get issuer certificate

I'm setting up a MongoDB server, and wanted to use TLS from a proper CA and DNS. I got a domain name and put an A record in, linking to my server. Afterwards, I applied for a SSL certificate on ...
0
votes
1answer
210 views

MongoDB is not using the index I created for this specific query

MongoDB 4.0. I have a simple query: db.product.find({ modifiedOn: { $gte: ISODate("2019-08-02T03:00:00.000Z") } }) .limit(10) And a simple index on modifiedOn....
0
votes
1answer
197 views

using mongorestore for a db present in my computer

I just started using mongodb so my question might be a little basic. I have a folder with the collections I want to restore(this was a zip file I downloaded from my email). How do I use mongorestore ...
0
votes
1answer
223 views

Mongostat display size / res

I would like to have your opinion and of course an explanation on the following. My configuration : mongodb version 3.4.4 1 replicaset with three identical servers( 4 cpu / 32 Go RAM under linux ...
1
vote
1answer
265 views

Can I delete manually data files for entire database in MongoDB

I like to optimize my backup strategy of my MongoDB. I have dedicated folders for each database: storage: dbPath: /mongodb directoryPerDB: true journal: enabled: true wiredTiger: ...
22
votes
2answers
119k views

Mongo Create a user as admin for any database raise an error

I am trying to create a simple user with the rights permission to access to any database and can do any actions. When I trying to execute the createUser command I got this error: db.createUser({ user:...
0
votes
0answers
10k views

Can't solve MongoParseError: Invalid connection string

I'm not able to solve MongoParseError. First my I tried this mongoose.connect(`mongodb://${process.env.DB_USER}:${process.env.DB_PASSWORD}@db:27017/${process.env.DB_NAME}`, {useNewUrlParser: true}); ...
0
votes
1answer
90 views

How to allow creation and deletion of a database or collections with user and password

I created a user with the role of userAdminAnyDatabase db.createUser({user: "Username", pwd: "password", roles: [{role: "userAdminAnyDatabase", db: "admin"}]}) and also user with the role of ...
0
votes
2answers
207 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
2k views

Change in bind_ip value is not reflecting

I have mongo installed on Centos instance in AWS and I am connecting to the mongoDB server from my system. To connect from remote system we need to change bind_ip value to 0.0.0.0 in /etc/mongod.conf ...
-1
votes
1answer
25 views

Creating a copy of a mongodb replica set

I have a mongodb replica set (1 primary, 2 secondary instances): vm1, vm2, vm3. I had a need for a second replica set so I created a copy of the above vms: vm4, vm5, vm6. After booting up vms[4-6] ...
8
votes
2answers
3k views

verify that mongos server is connected to config servers

I've been writing a backup script for sharded replica-sets and it's almost done. Except I can't seem to get it to successfully start the balancer backup after everything's all said and done. Here's ...
0
votes
1answer
783 views

Mongo: how to covert a string to decimal?

I have written millions of documents with $CURRENT_CASH_BALANCE as strings instead of decimals. How can I convert them all to decimals?
0
votes
1answer
350 views

MongoDB Aggregate Poor Index Usage

I've been trying to understand the MongoDB Aggregate process so I can better optimize my queries and I'm confused by usage and $match and $sort together. Sample DB has only one collection people [{ ...
0
votes
0answers
15 views

GroupBy with count array in MongoDB

I have a collection and object where this object has a list of objects as following: { "_id": { "$oid": "615617f5b0cd1765b7ba21c1" }, "response": { &...
0
votes
1answer
703 views

Expand a date range in mongodb

I have a document structure like { "startDate": ISODate("2015-01-01T00:00:00Z"), "endDate" : ISODate("2015-01-10T00:00:00Z"), "foo" : "bar" } Is it possible to expand the date range like this?...
0
votes
1answer
22 views

Mongodb continuous schedule and cancel catchup takeover on replica set member

We have a mongodb 4.2 (stable branch) replica set with three members. It was working for several months without problems. Yesterday one of the secondary members started to do very strange things. I ...
0
votes
1answer
248 views

MongoDB cannot be started after moving the server

I had a happy MongoDB 3.0.5 installed on a VM on a Windows 2012R2 Server, for light use. I moved the VM to a new physical server without any major changes, and to my surprise it cannot be started; and ...
3
votes
3answers
3k views

Bind MongoDB to IPv4, as well as IPv6

Mongo v. 3.4 respective part of config file: #network interfaces net: port: 27017 bindIp: 127.0.0.1,192.168.0.15,2001:db8:0:0:0:0:2:1 (IPs are made up) No matter the format I've used: [2001:...
1
vote
2answers
436 views

RHEL 7.4, heavy workload(s) and SWAP usage

This might not be the correct board for this, but since I'm a DBA and I'll ask here. I have several RHEL 7.4 servers, running a mix of MariaDB (10.1, 10.2) and MongoDB (3.4). The problem was ...
2
votes
1answer
194 views

lat, long based search with $near shutdown my mongodb on Linux server

Hey guys i am stuck on critical problem & unable to resolve it. I have a project where there is a collection of UK postcodes having 18,00,000 sample postcode records. I have a search query where i ...
0
votes
1answer
164 views

How do I import the _id index from a MongoDB collection as a hash index for a PostgreSQL table (from a CSV export from MongoDB)?

I want to be able to keep track of the _id index values that get the MongoDB collection uses when I export the MongoDB collection (via CSV) and import the data into a PostgreSQL DB table (basically ...
2
votes
1answer
957 views

Mongodb replica set primary and secondary node conf fail when one slave is down

In my env, I had created MongoDB replica set conf for high availability so one server fails should be handled by other also in my conf I have 3 DB server and 1 arbiter too but, my slave's server ...
1
vote
1answer
852 views

Inserts very slow near the end of dataset

I'm trying to insert Whois Records ( domain name and relevant info) into MongoDB after parsing them from CSV files. I currently have a collection for each TLD such as .com, .org, etc. During the ...
0
votes
1answer
84 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
2 3 4 5
46