Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [mongodb]

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

0
votes
1answer
15 views

MongoDB failed to start after adding keyFile config

I have issue with mongod service after adding keyFile in config. I follow instruction from here : https://docs.mongodb.com/manual/tutorial/deploy-replica-set-with-keyfile-access-control/ after adding ...
0
votes
0answers
17 views

Mongo zoned sharding with a single value

We have a database with around 50 collections, and 70 million records. All records belong to specific customers and have a customerId property. Currently all clients are in the USA. However, we're in ...
1
vote
1answer
32 views

How do I add and/or modify $jsonSchema for a MongoDB collection from within the NodeJS driver? [on hold]

I would like to use the MongoDB native schema functionality in a Node application using the MongoDB NodeJS driver. I do not want to use Mongoose for this. Mongoose has it's own implementation of ...
0
votes
2answers
21 views

Mongodb replace default _id with string

I replace MongoDB default _id with type string. And now I want to sort my collections, the result _id after sort is: 1 10 100 101 2 20 200 I want the result like sorting number which is: 1 2 3 4 5 ...
0
votes
1answer
13 views

How to close mongodb idle connection(active: false)?

I have an application running on node and using the mongodb library to establish connection and closing it. But the problem is, from the mongo serverStatus() command i can see that there is still 2k+ ...
1
vote
3answers
28 views

Does pure MongoDB use schemas and models like Mongoose?

I'm new on pure MongoDB and I've some questions about pure MongoDB. 1. Does pure MongoDB use schemas and models like Mongoose ODM? If you have used Mongoose ODM, you know that Mongoose ODM uses ...
0
votes
1answer
25 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 ...
0
votes
2answers
18 views

Periodic aggregations on MongoDB Atlas

I have been developing a solution that uses MongoDB Atlas (currently M0) for storage. As I would need to provide some statistics throughout different time periods, I need to run periodic aggregations ...
0
votes
1answer
34 views

what is most efficient way to retrieve next and previous items based on ordering and current item only

So I have this problem in many of my apps and I don't even know how to describe it correctly. I'm using MongoDB (3.6) so my IDs are hashes. I have a table/grid view, which displays items mapped to ...
1
vote
1answer
35 views

MongoDB replica set outage “due to bad connection status”

I have a production replica set that went down for 3-4 minutes, apparently because the Primary could not connect to the Secondaries. I'm having a hard time understanding why a Secondary didn't take ...
0
votes
2answers
34 views

CSV file restore in mongodb

Export MySql data in following command. SELECT id,documentfile FROM documentuploads INTO OUTFILE '/home/home2/agri_doc.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n'; CSV ...
0
votes
2answers
25 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 ...
1
vote
2answers
73 views

How to influence files (pre)allocation steps (max growing value) in MongoDB 3.4 with WiredTiger

We have in environment deployed some really small DBs (5GB) as directory per DB.Under dirs is LVM with XFS, where we have implemented logic for "brake" when DB space should be full-filled (all is due ...
2
votes
1answer
40 views

how to generate the root CA.pem in mongodb for configuring the ssl certificates?

I am trying to configure the SSL certificates in the MongoDB community edition. The configuration of my mongod.conf net: port: 27017 bindIp: 0.0.0.0 # Enter 0.0.0.0,:: to bind to all IPv4 and ...
0
votes
2answers
31 views

arbiter bring down the three node mongodb replica set [duplicate]

I have a typical 3 node mongodb replica set. One primary, one secondary and one arbiter. I thought the replica set would survive one node offline but it didn't. Please help me understand what went ...
0
votes
1answer
29 views

connecting to mongodb on ec2 instance using the private IP address

Im trying to connect to my MongoDB that is on my EC2 instance. I am able to connect to using the public dns with this statement: mongoClient = new MongoClient("ec2-3-92-197-163.compute-1....
0
votes
0answers
5 views

UnhandledPromiseRejectionWarning doesn't reach Catch [migrated]

This is my code: db.Registration.model.countDocuments() .then(function (count) { return res.status(200).send({ count }); }) .catch(function (err) { console.log('errrr', err); if (err) ...
0
votes
2answers
35 views

Mongo count query taking long time though index is being used

The following count query is taking lot more time than expected though index is being used and keysExamined , docsExamined are also less query = {'indxed_field': 'x', 'a': 'test', 'b': {'$ne': True}...
0
votes
1answer
27 views

First query is really slow with WiredTiger, not with mmapv1

We recently upgraded to MongoDB 4.0. Loving the performance improvements with WiredTiger, but all of a sudden our test suite is timing out on certain machines. Before running our tests, we run the ...
0
votes
0answers
36 views

Can Mongo Handle This SQL Aggregate Query? [closed]

I have this SQL query which runs through 10 million rows in about a second and produces this output: |---------------------|------------------|------------------| | LabID | Matched ...
1
vote
0answers
27 views

MongoDB SECONDARY replica keeps failing on STARTUP2

I'm converting standalone existing MongoDB instance to a replica set for backing up without affecting primary instance. To test minimal replica deployment I've set up two MongoDB instances on the same ...
1
vote
0answers
15 views

How to store metadata derived from Named Entity Recognition (NER) in MongoDB documents? [on hold]

I have collection of news articles in this format: { "_id" : ObjectId "author" : "title" : "description" : "url" : "urlToImage" : "publishedAt" : "content" : ...
0
votes
1answer
24 views

How to update a field in a nested JSON document in Mongo?

How to update a field in a nested JSON document in Mongo? { _id : '123' friends: [ {name: 'allen', emails: [ { video: { name:'abc', subType:'video', ...
1
vote
1answer
29 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
0answers
29 views

trying to merge chunks to trigger better balancing after 50% of the data was deleted by the developers

Trying to merge chunks using the following command: db.adminCommand ( { mergeChunks: "HTMLDumps.HTMLRepository", bounds: [ { "ShardMapId" : 2, "DomainId" : ...
1
vote
1answer
23 views

Set mongodb's `maxIndexBuildMemoryUsageMegabytes` setting in conf file

In the mongodb documentation for the configuration options it says that I can specify how much RAM index building will consume: maxIndexBuildMemoryUsageMegabytes: Limits the amount of memory ...
0
votes
1answer
27 views

Help understanding mongodb explain results

I have an index on field f1. {f1:1} Running an explain on the following query db.coll.find() says that the winning plan is a CollScan (expected) However, for db.coll.find().sort({f1:1}) the ...
1
vote
1answer
50 views

Connect mongodb 4.0 with robomongo

I am facing an issue with the mongodb 4.0. I have setup mongodb on remote server and want to connect it with robo3t. But getting the below error. And here is my mongodb.conf file # mongod.conf # ...
0
votes
1answer
37 views

Is MongoDB index creation single threaded?

I have rather big dataset - 2TB of text data, 18.000 millions of lines. Each document is same: 5 fields: 4 strings + 1 integer. All fields should be indexed and searched by. That is: array of 3 ...
0
votes
0answers
34 views

MongoDB Indexes [getting deleted automatically] | Missing

This problem might look strange. Please bear with me :) It's an application(NodeJS - MongoDB) helping with storing and viewing of LoRa Packets. Background: It's a CentOS 7 on Azure Instance. ...
0
votes
1answer
30 views

Mongodb creating historical cluster replicaset

I've a use case which I'm trying to implement.. There is a replicaset(3 nodes) which is primary production cluster, I want to set up a historical cluster another replicaset(3 nodes) which replicates ...
2
votes
2answers
34 views

Mongodb consumes too much RAM during replica resync

I have a mongodb cluster with 2 data nodes and 1 arbiter. I use mongodb 4.0.7 for all my centos VMs. A few days ago one of my servers (lets call it data-2) had a fatal crash and requested a complete ...
0
votes
2answers
37 views

Replica Set in MongoDB by using IPs instead of domains?

I want to use MongoDB in replica-set mode over 2 servers by IPs.But when I deployed the secondary one on other server, I faced the issues about connecting between 2 instance. For example, the primary ...
1
vote
2answers
78 views

How can you view the IP addresses of active MongoDB Atlas connections?

Some posts show you can use db.currentOp(true) to show active connections, but when I do that I get this error { "ok" : 0, "errmsg" : "Using $all for currentOp is disallowed in this ...
0
votes
0answers
9 views

Php MongoDb Close Connection [migrated]

I am using php mongodb driver in my application, But I am facing an issue with this as I have 16 load balancers and only one mongodb server my mongo shuts down when there is lot of load. The new php ...
0
votes
1answer
20 views

how to set different file system for dbpath in mongodb

how to set different file system for dbpath in mongodb- I have /data1 , /data2 , /data3 file system available for data path, I would like to use given 3 file sy
0
votes
1answer
58 views

Replication or Sharding (MongoDB)

I understand each of the terms but I do not understand very well if they can work simultaneously. In my case, for example, I have a machine with 20GB and I would like to know which is the best ...
4
votes
1answer
128 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 ...
1
vote
0answers
29 views

Background index creation resource provisioning

I have a long running background index creation running in MongoDB. However, the CPU and RAM usage is below 30%. Is there a way to allocate more resources to the index creation process or is it ...
0
votes
1answer
59 views

Recover a mongo database deleted by rm

My developer accidentally lost our database by a bash script, which turned out to run rm -rf /* (see this thread). Thanks to extundelete, he just recovered the /data/db/ folder: However, he could not ...
0
votes
1answer
10 views

shard key specification

I have a document like so: { "_id" : ObjectId("52f29f91ddbd75540aba6dae"), "teams" : [ { "name" : "Washington Bullets", "score" : 100, "home" : ...
1
vote
1answer
14 views

Add Secondary to Replica Set in MongoDB Windows

I am trying to add the second replica set to primary. Primary = 192.168.56.52:27017 Secondary = 192.168.56.136:27017 # mongod.conf # for documentation of all options, see: # http://...
0
votes
0answers
22 views

Mongodb covered query executionStats

Hello i'd like some help understanding the following execution stats. For this query db.family.find({ "_id" : ObjectId("5c87890b3adcde7da566f0d7")},{_id:1}).explain("executionStats") "...
1
vote
0answers
15 views

splitting an string in an array into an array Mongodb

I have the current document: { "_id" : ObjectId("5c95b81b10ce2a953215c269"), "name" : "Œufs & Cie", "city" : "Brossard", "state" : "QC", "postal_code" : "J4Y 0G4", "...
0
votes
0answers
24 views

MongoDB: Approach for storing frequently modified references

Need a piece of advice for storing a large number of references between Mongo entities that are frequently updated. Some background: 1 event can have 5000 logs. 1 event can have 10 assets associated ...
0
votes
1answer
19 views

Single collection for multiple keys

I built a little setup with a raspberry pi and a temperature and humidity sensor. Every 5 minutes it reads sensor values and sends them both + a timestamp and a custom ID (there are multiple pis, each ...
0
votes
1answer
19 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 ...
2
votes
1answer
22 views

What is the meaning of “Monotonically Changing Shard Keys”?

I am writing my first pubblication concerning MongoDB and more specific MongoDB Sharded clusters. On the documentantion I found that the shard key in case of ranged sharding should be "Non-...
-2
votes
0answers
24 views

MONGODB CLUSTER

I have my percona mongodb cluster with 3 servers one being master, but we had a downtime whereby after services recovery one of the server disconnected from the cluster and cant connect with an error: ...
1
vote
0answers
32 views

Mongodb won't start after adding 2nd net option to mongod.conf file

I try to add another net with the its corresponding bind ip and port to my AMI ec2 mongod.conf file so I will be able to create a 2 node replica set but when I run the command "sudo service mongos ...