Questions tagged [mongodb]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
12 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
0answers
7 views

Query trajectories that intersect two regions in pymongo

Consider a mongo db 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 ...
0
votes
2answers
12 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 :::* ...
0
votes
1answer
7 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 ...
-1
votes
1answer
24 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] ...
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
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
65 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... {&...
0
votes
1answer
39 views

parse json into a relational database or use a NoSQL?

I am retrieving a JSON file from an API which size varies between 100kb to 7mb. The structure of the response is: I initially thought in storing the response in a relational database, with the ...
0
votes
0answers
9 views

Track large update process

I need to remove FirstName and LastName nodes from all documents in collection. The thing is that there are 150M records in it. I plan to use simple code db.collname.updateMany({}, { $unset: { "...
0
votes
0answers
27 views

aggregation with group by, inner join and nested conditions in MongoDB

First of all I am sorry if this is a basic question, I am new to queries in MongoDB. Well, what I need is to find the latest registers for a worker in my WorkerLocationContext document and the latest ...
0
votes
0answers
21 views

Downsides of creating new collections for the same data in mongodb

My app saves alot of data from different companies on the same format, is it better perfomance wise to have a single collection and separate them by a companyId key or to have multiple collections ...
1
vote
2answers
41 views

Best way to study a new type of database if you are experienced in another type

Does anyone have a good approach to learning a new type of database when they already are proficient in another one? I have thought about writing notes to myself about how to do various tasks that I ...
0
votes
0answers
25 views

Unable to connect to Mongodb database using the Mongodb compass

I have created a mongoDB database on DigitalOcean, then I try to establish a connection to the database using MongoDB Compass. However, when I try to do so, "connect ECONNREFUSED 143.198.217.148:...
0
votes
1answer
39 views

mongodb write issues

We have 5node replicaset , in which 2 servers are in Jacksonville datacenter and 2 servers are on Atlanta datacenter and an arbiter . I had brought down the Atlanta servers , but the write operations ...
0
votes
1answer
22 views

Is ObjectId as shard key unique across shards or just within a shard?

In my sharded cluster of version 4.2, one collections is sharded on _id where _id is just a default ObjectId. I'm seeing multiple documents with same _id on different shards' primaries. When I specify ...
0
votes
1answer
25 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 ...
1
vote
1answer
84 views

MongoDB - Slow aggregate query

It takes around 6min to get the result from MongoDB, when I use the following aggregate query. db.barcodes.aggregate([ { $lookup: { from: 'company', localField: '...
0
votes
2answers
28 views

Not able to shard collection

I have enabled sharding using the below commands. mongos> use news switched to db news mongos> sh.enableSharding("news"); { "ok" : 1, "$clusterTime" : { ...
0
votes
0answers
15 views

Does MongoDB client drivers reconnect after restarting from shutting down?

For example, suppose there is an app connected to a mongos, and the mongos instance shutdown. The queries to the MongoDB failed, and after sometime, the mongos restarted. Does the client driver ...
0
votes
1answer
44 views

Why insert statements get slow when having too many indexes?

I am having a slowness in my insert statements when working with MongoDB, and when I did a quick investigation, I though this might happened because the table has 11 indexes. Plus, I know that when I ...
0
votes
0answers
57 views

How to create an index on MongoDB for Multiple Fields

I am looking to create an index on MongoDB, am relatively new to this type of DBMS, have looked in the MongoDB log and noticed that its doing a COLLSCAN which from reading online can indicate that an ...
0
votes
0answers
29 views

How to smooth high write peaks (every 60s) in a write-heavy MongoDB?

We have a MongoDB cluster (3-member replica set, no sharding), operated on AWS. The application has a very write-heavy pattern. While the average write IOPS stay under 5k, most writes occur in peaks ...
0
votes
0answers
18 views

Enable username and password authentication on mongodb sharded cluster

I have a mongodb cluster(1 mongos, mongo config replica set with 2 members, 1 shard with 3 members) and I have enabled internal authentication in config replica set. Also my backend code connects to ...
0
votes
0answers
15 views

premission denied: mongoDB not working when calling mongod

when i try to start mongodb in vscode as: $ mongod it replay: bash: /home/linuxbrew/.linuxbrew/bin/mongod: Permission denied why and how to fix it?
0
votes
0answers
12 views

Mongostat not displaying inserts to time series?

I'm using MongoDB 5.0.2 and mongostat 100.5.0, and I notice that I'm not able to monitor insert for time series, or at least they do not show up. Is there either some way to enable this, or to monitor ...
0
votes
0answers
13 views

MongoDB Index Restore Failure Since I Upgraded from 4.2 to 4.4

Steps to reproduce After upgrading from 4.2 to 4.4, take backup using mongodump Now restore backup On some collections, I am getting following {"alternate":"non-ignorable", "...
0
votes
2answers
22 views

How to organize MongoDB replicaset backup and alerting

I have a running MongoDb replicaset consisting of 2 replicas and 1 master nodes. Recently I noticed that my master gone and automatic failover took action and changed master, however I wasn't aware of ...
0
votes
0answers
17 views

MongoDB / WiredTiger indexes became much larger after dump / restore

I've done a migration from one replicaset to another. The OS and mongo version is the same 4.4.8 (maybe initial creation of prod03 was 4.0 or 4.2 with updates to 4.4.x). Now I see substantial growth ...
0
votes
1answer
31 views

Incorrect migration of an object from Firebase to MongoDB

I am in the process of migrating a database from Firebase to MongoDB and am facing a problem. Here is such an object I have stored in the FB: "logs": { "2021-05-24": { &...
0
votes
0answers
31 views

document db tree structure - is it valid to have both child and parent references in each node?

I'm in the process of building a tree structure, which should support the following requirements: It should be possible to find the root of the tree The tree will most often be traversed from root-&...
0
votes
1answer
19 views

In MongoDB ReplicaSet, does a priority 0 node (hidden, delayed, etc) have to have the same Oplog size as the nodes that can become primary?

I understand the Oplog collection in MongoDB replica set. A bigger Oplog means a bigger recovery window when a data bearing node goes down. However for nodes that can never be primary, is the Oplog ...
0
votes
0answers
16 views

How bulk query mongodb where each filter has its own limit?

I'm trying to create a search algorithm that will return more diverse results based on one common field in my "Articles" collection in my MongoDB. My "Articles" schema basically ...
2
votes
0answers
28 views

How does MongoDB solve the concurrency issue for meeting room booking problem? [closed]

When implementing a typical meeting room booking system with RDBMS, there will be two operations: -- Check for any existing bookings that overlap with the period of noon-1pm SELECT COUNT(*) FROM ...
0
votes
1answer
36 views

why it is not recommended to run mongod process as root user as per documentation

Why is it not recommended to run mongod process as root as per the documentation? Is it only security that we run it as a non root user ? Will running as root cause any specific issues like Out of ...
0
votes
0answers
30 views

Why MongoDB Shard becomes slow in data insertion over larger amount data inserted?

General We generate about 10GB of records each day. Each record is composed of four columns: id,A,B,C. The column id must be unique but will be never queried. Columns A,B,C must be indexed (or some ...
1
vote
1answer
27 views

issues after mongorestore completed

Once mongorestore is completed. Most of the times one of the node will not be able to catch the primary after the restore is done on primary and that becomes too stale to replicate from Primary. What ...
0
votes
1answer
23 views

Mongodb Discrepancy between space actually used and space available

I'm not sure if this has already been asked but I'm facing a weird issue in MongoDB 4.2.8(Standalone). We have a single collection running which uses a TTL index to delete all documents that are older ...
0
votes
0answers
17 views

MongoDB - Grant permission over one collection that exists on all databases

I have several databases on my MongoDB, all of them have or will have a collection called _schema. Currently, I'm granting permissions like this: db.grantRolesToUser("userA",[ {"role&...
0
votes
1answer
58 views

How does MongoDB Treat Mixed Types?

I'm messing around with mongodb and noticed I can create mixed data types. db.getSiblingDB("bermuda").getCollection("test").insertOne({ "profile": { "t1&...
0
votes
0answers
29 views

Help find a usecase to understand sql vs nosql issue [duplicate]

I have very little background in SQL (one pet project with PostgreSQL that demonstrated only basic queries up to joins) and no experience at all with NoSQL. I understand that there are many DB ...
0
votes
0answers
13 views

recreate available connections = zero condition on mongodb replset

Default ulimit for mongo user is 1024, and max connections that mongo uses is 818 which is 80% of 1024. When the next connection reaches 819, mongod will cease and will not accept anymore clients ...
0
votes
0answers
24 views

Robo 3T able to bypass MongoDB auth=true

I used robo 3t to login to a database and was surprised that I was able to write on the collection despite having a read only role, by adding a document via the GUI or sending commands through Robo 3T....
0
votes
1answer
75 views

How do I restore a database using MongoDB 5.0 CLI?

I've just installed the MongoDB version 5.0 CLI tools on my workstation. But now when I go to restore a database like I've always done I get an error: mongorestore mongorestore : The term '...
0
votes
0answers
27 views

How to convert array objects with object ids as one of key value pair to string?

I have the following JSON, How to convert an array of objects with object ids to string in MongoDB using aggregation query? { "_id": ObjectId("60e41eb7335412757cc6cb9a"), "...
0
votes
1answer
38 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
0answers
25 views

mongodb connections from secondary node reaching max connections allowed

I've noticed connections count from 2 of the secondary nodes in a 3 node replica set reaching max connections allowed on primary and hence mongodb instance not responding for any queries and becomes ...
0
votes
1answer
29 views

Obtain user and host who inserted data MongoDB

I am facing a problem with some data in my current database. There is a collection which is being populated and update through a NodeJS application. This collection possess a children which is an ...

1
2 3 4 5
46