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
9 views

MongoDB Containers Memory Settings

is it ok to set memory limit of mongos, config server and shards to 500MB in a container environment? What should be the ideal memory setting?
0
votes
0answers
16 views

MongoDB Replication Info Results [closed]

I want to understand the following: First-Third execution of db.printSlaveReplicationInfo() results to “0 secs (0 hrs) behind the primary” Fourth execution of db.printSlaveReplicationInfo() results ...
1
vote
2answers
39 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
10 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
35 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
20 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
21 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
77 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
25 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
14 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
35 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
30 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
27 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
17 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
14 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?
-2
votes
0answers
11 views

Installing mongodb in aws ec2 Ubuntu

I want to install Mongodb Community with replica-set in Aws Ec2 Ubuntu 20.04LTS. I need to store data in EBS and want to keep my secondaries in different availability zones. I want to use VPC. I am ...
0
votes
0answers
11 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
9 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
19 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
11 views

Connect MongoDB replica set with Vault

I have a MongoDB replica set cluster with one primary node and two secondary nodes. I created a user inside admin db of my primary node using the below command db.createUser( { user: “myUserAdmin”, ...
0
votes
0answers
16 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
19 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
29 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
15 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
23 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
28 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
21 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
15 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
36 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
23 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
47 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
25 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
23 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 ...
0
votes
1answer
35 views

mongodb - chained replication related questions

In case of default replication which is chained replication in mongodb. Say for example in a 3 NODE replica set : NODE1 is primary and NODE2 is immediate next to NODE1 and catches up all oplog to ...
0
votes
0answers
15 views

How to interpret results of mongo explain and improve geo spatial query?

I have a collection in MongoDB where the documents have a structure like this: { "vechicleDetails": { "location": { "type": "Point", ...
0
votes
1answer
49 views

mongodb query or JS to print health state of a replica node

If I've to get something like analogous to SQL statement from rs.status output to print specific value of an attribute in mongoDB - Something like print health of specific node of a replica set from ...
1
vote
0answers
25 views

Stroring field name instead of referencing using objectId [duplicate]

This is my first question here For example: I have a post document which contains list of people who like it and my question is Should i store each person in the array using objectId or username(it's ...
0
votes
1answer
20 views

Mongo - How to update a property of a document using a nested value of the same document

I want to update a document using a nested value from that same document. So if I have an document that looks like this: { _id: ObjectId("60b002d490b01b63eee5d4b7"), title: 'foo', ...
0
votes
1answer
39 views

Update priorities on mongo based on host name using JS

Is there a way to adjust priorities of the nodes based on hostname instead of sequence. Using sequence - cfg=rs.conf() cfg.members[0].priority=100 cfg.members[1].priority=10 cfg.members[2].priority=...
0
votes
1answer
33 views

Relational or non-relational when dealing with highly relational, big data [closed]

I'm working on a project (in Java) that will be processing a large event stream (GBs every minute). This data is heavily processed to find relationships between events. This is done through a ...
0
votes
1answer
28 views

Error on adding an arbiter

Adding 5th node getting an error "Our replica set configuration is invalid or does not include us Presently all 4 nodes are healthy. node arb1 arb2 rs1 m1,m2,m2 a1 when I try to add a2 both ...
0
votes
0answers
21 views

MongoDB restore. Recover after failure

Is it possible to resume mongo backup restoration after failure? I'm getting an error 2021-07-01T23:35:01.944+0200 Failed: dbname.collectionname_backup: error restoring from archive 'mongodb-db-...
1
vote
1answer
211 views

Understanding why MongoDB uses more RAM than the allowed wiredTigerCacheSizeGB

My mongod command mongod --wiredTigerCacheSizeGB 5 In practice, I'm getting mongo instance to use even up to 8.6 GB (on a VM with 50 GB RAM) Indexes are using about 100 MB (checked with db.stats()) ...

1
2 3 4 5
46