Questions tagged [mongodb]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
36 views

MongoDB / PHP - How to change data type for every occurrence of field in a document

I'm trying to learn how to use MongoDB with PHP. I Have built a web application that loads data from database etc. The issue I am having is that when I import my data from a .CSV using MongoDB Compass,...
0
votes
0answers
15 views

MongoDB user password changed for already open connection

We're introducing this new password management infrastructure that changes passwords every X days, but there're these existing implementations in place that use singleton repositories, so once a ...
0
votes
0answers
25 views

mongodb after restoring replica-set from backup the primary is not master

after recovering replica-set from a snapshot (for testing) when I run commands on the primary I got error not master and slaveOk=false does primary not equal to master? I got this output for the ...
0
votes
1answer
57 views

Exception during recovery in mongo

I tried to recover from a sudden shutdown of mongo, but I am experiencing some problems. Here is the log file ***** SERVER RESTARTED ***** Thu Apr 25 01:09:17 [initandlisten] MongoDB starting : pid=...
0
votes
1answer
27 views

mongoDB: Limit user to find documents only by ObjectId

I'm using mongoDB version 4.0.9 for various things. One of them is storing and retrieving files in mongoDB via GridFS. For that purpose, I have created a role/user in mongo with the privileges "...
1
vote
0answers
10 views

Mongo DB sharding concept of read/write [closed]

I am trying to set up mongodb sharding and almost done. 1. completed 1 config replicaSet 2. completed 1 shardsvr replicaSet 3. multiple mongos routers connected to config and shardsvr also done I ...
-1
votes
1answer
65 views

What are the pros and cons of having more data-bearing members in a MongoDB replica set? [closed]

A 3 member replica set has the same fault tolerance if all 3 members contain a copy of the data or if one is an arbiter so why would I ever want all 3 members to have a copy of the data? What is a ...
1
vote
1answer
39 views

Mongo DB multiple replicaset

I am trying to create multiple mongod instances on windows . I run on 2 ports [27017,27020] with replSet ["ReplSet1","ReplSet2"]. first instance 27017#ReplSet1 is OK. But the second instance 27020 ...
0
votes
1answer
24 views

Is it possible to retrieve a history of the remote connections to the MongoDB including the IP addresses and the executed commands?

For some reasons I disabled the user access control and somehow all collections have been wiped out. So I want an activity log to find out how this happened I need a list like this: | Date/Time ...
0
votes
1answer
28 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: ...
1
vote
1answer
45 views

Writing MongoDB logs to a remote logging server

I am trying to forward MongoDB logs from several remote servers to a central logging server. To do this, I changed my mongod.conf files to use syslog like so: systemLog: destination: syslog ...
0
votes
0answers
17 views

mongodb auto index future collections, big json size, correct structure?

We are going to index some data in mongodb (probbably), from some api calls sending json data ~10MB size, splited data in dates. Since the data is large, I think it's better to split the result in ...
1
vote
1answer
42 views

My MongoDB Atlas Operations graph has doubled in the last few hours. How do I go about debugging this?

I noticed this graph in my MongoDB Atlas dashboard: I'm not sure what is causing the increased Disk IOPS and Operations counts... Can I use the oplog to figure out what is causing this massive ...
0
votes
1answer
52 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
1answer
47 views

MongoDB - Does WiredTiger benefit from virtual cpus cores the same way it does with physical cores?

According to https://docs.mongodb.com/manual/administration/production-notes/#id5 The WiredTiger storage engine is multithreaded and can take advantage of additional CPU cores. We will be running ...
1
vote
1answer
109 views

Why $group is very slow in aggregation and how can faster it in MongoDB [closed]

My query is taking ~3 seconds to execute with the $group stage, How can I faster this? My query is: db.getCollection('employee_data').aggregate([ { $match: //Filter }, { $group: { ...
0
votes
0answers
62 views

Converting MySql Schema to MongoDB (Mongoose)

I am trying to convert MySql schema to MongoDB. I do understand how to make a reference to Users Table - UserId. My question is how to make a reference to Symbols Table - Symbol ? Here you will find ...
1
vote
2answers
51 views

Can sharding help in this scenario? [closed]

I will have around 600 GB of data in single table with multiple columns in MySQL. Basically this table will store user events from application. Indexes are there on required columns. Question: If I ...
0
votes
0answers
50 views

Error: No primary detected for replcaset

We have a Mongo cluster with 4 shards. Each shard with 3 nodes (Primary, Secondary, Arbiter). (rs1,rs2,rs3,rs4) - config server rs1 shard completely down, so we rebuilt the rs1 with backup we have ...
0
votes
1answer
73 views

mongodb read write locks

I'm currently investigating the possibility of using mongodb. This would contain the a collection of 100million+ documents. I need a process that will be constantly running deleting documents older ...
-2
votes
1answer
45 views

Is MongoDB an appropriate choice for storing large files as compared to MySQL? [closed]

I'm working on a project to store large JSON files (~1 MB each) in a database, with 10 of these files linked to one user profile. Normally I would use MySQL, and have two tables, one with the meta ...
1
vote
1answer
74 views

Impact of RAM size on mongodb performance

I'm trying to test the impact of the size of RAM on the performance of mongodb. So far I can't find such impact and trying to figure out if the methodology I use is correct and if not, what to change. ...
1
vote
0answers
188 views

MongoDB ReplicaSet instance re-join after Kubernetes POD restart

I have simple MongoDB deployment in Kubernetes with PersistentVolumeClaims. Roughly like this: apiVersion: v1 kind: Service metadata: annotations: service.alpha.kubernetes.io/tolerate-unready-...
0
votes
0answers
38 views

Mongo - Find is returning differents results with each request

Currently in my collection has the following spec: Version: MongoDb - 4.0.6 Sharding: 3 shards Shard key: Publication identifier The shards are consistent The problem is due using the same operation ...
0
votes
1answer
130 views

Installation problems

After a fresh install of mongodb following the instruction here https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/index.html I seem to have a problem: ludo@aegir:~$ sudo service ...
1
vote
1answer
34 views

How should I build the architecture of my MongoDB database? [closed]

I have a project about e-Sports. In this project, I have VDS Game Servers for players. With this game servers, our players will play Ranked Games and players will earn Matchmaking Rank Points for ...
0
votes
1answer
21 views

What are each of the separate mongodb-org packages for ubuntu?

I am installing mongodb on a local ubuntu vm and I'm using the official Mongo supported packages per the official instructions. However, I don't know what each of these packages contain. I know this ...
0
votes
1answer
70 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
28 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
0answers
163 views

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

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
1answer
60 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
607 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+ ...
2
votes
3answers
417 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
30 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
106 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
45 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
477 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
128 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
36 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
100 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
535 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
66 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 ...
1
vote
1answer
424 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
2answers
456 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}...
1
vote
1answer
231 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 ...
1
vote
0answers
104 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
23 views

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

I have collection of news articles in this format: { "_id" : ObjectId "author" : "title" : "description" : "url" : "urlToImage" : "publishedAt" : "content" : ...
0
votes
1answer
944 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
48 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
40 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" : ...