Questions tagged [mongodb]
All versions of MongoDB - a scalable, high-performance, open-source, document-oriented database.
2,410
questions
0
votes
0
answers
6
views
Unable to query against secondary replica mongodb
I am trying to query against secondary replica by opening mongoshell query window for secondary node using Studio3t. However, I am unable to run query against secondary node
Error:
MongoServerError: ...
0
votes
0
answers
15
views
Getting a good shard key for mongodb for billions of records
At my company we have a mongo collection that has reached 120 million records that is currently sharded. Sadly and painfully, the chosen sharding strategy has been shown to be really bad: suffers both ...
-3
votes
0
answers
76
views
SQL vs NO SQL tradeoffs
Since consistency is tied to distributed nature of a system, does SQL also loose consistency when done sharding. In that case its just like a NoSQl database but with defined schema. What actually is ...
0
votes
1
answer
18
views
MongoDB index not used depending on query formulation
We see in one of our services that certain queries always result in a COLLSCAN, instead of the appropriate index being used. The data has the form
{_id: DocumentID, "field": {"child&...
0
votes
0
answers
20
views
Upgrading database instance for MongoDB 4.2 to 4.4 requires legacy MongoDB on Macosx
I'm running MongoDB within a ten year old node app, and in the process of upgrading node had to upgrade MongoDB. For some time, I have been using MongoDB community 4.4 to run the database, but in the ...
-3
votes
0
answers
19
views
how to sort the output [closed]
db.currentOp(true).inprog.reduce(
(accumulator, connection) => {
ipaddress = connection.client ? connection.client.split(":")[0] : "Internal";
accumulator[ipaddress] = (...
0
votes
1
answer
22
views
MongoDB Replication for Backup
Our's is a small application. Every day we do mongodump and take DB backup to Amazon Glacier. Instead of this I would like to use MongoDB replication that will copy actual database on another ...
0
votes
0
answers
22
views
migrate from Bitnami to Atlas
I have to migrate from MongoDB packaged with Bitnami (sharded helm chart with 0 shard) to MongoDB Atlas (replicaset or sharded cluster)
Do you know if there is a way to do that ? Does that mean ...
0
votes
0
answers
28
views
Would Partial Indexes allow quering the data
Assumming we have 3 columns which are relevant for partion : key1 , key2 and lastupdateddate.
when we delete a lot of records from collection (~billion of records) , the index {key1:1,key2:1,...
0
votes
1
answer
33
views
Index use after unwind in aggregate
We have a collection in our MongoDB where due to a changed use-case a so-far small query is now really slow. The aggregate in question is somewhat like this:
db.collection.aggregate([
{
$match: {...
0
votes
1
answer
41
views
MongoDB ReplicaSet system configuration and modeling
I want to create a replica set model that look like this:
PC 1 : ip=1.1.1.1 - The only one that writes
PC 2 : ip=2.2.2.2 - Read only
PC 3 : ip=3.3.3.3 - Read only
Use-case: On PC 1 I have a program ...
0
votes
0
answers
19
views
How to Create a Case-Insensitive Search Index for Multiple Fields in MongoDB Atlas Search
I'm working with a MongoDB collection named skus and need help creating a search index and query for case-insensitive search across multiple fields with priority. Here's a sample document from the ...
0
votes
1
answer
34
views
MongoDB createIndex compound unique index on array field
I'm trying to create a unique index in MongoDB that enforces uniqueness based on the existence and non-undefined nature of a field (barcodes) in my skus collection. Here's the index creation query I'm ...
0
votes
1
answer
49
views
Removing mongoDB from MacOS
I need to delete all mongoDB thing in my mac.
i followed the uninstall guide on mongoDB uninstall official guide
but on step 2 which is
`launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb-...
0
votes
1
answer
23
views
How to transfer precomputed mogodb index to another machine?
I have a local mongodb database that i want to transfer to a free tier aws ec2 t3.micro instance.
The problem is that one collection in the db is a bit larger(1.2 GB, 24M docs), so there is no way i ...
1
vote
0
answers
38
views
Taking full and incremental backups with authentication in MongoDB
We have a multi-tenant micro-service (it's basically kafka with some bells and whistles). We are using Mongodb to store multi-tenant credentials and kafka data so the authentication is really tight. ...
0
votes
2
answers
33
views
How to rename hostname in a Mongodb replica set
I need to know how I can rename my hosts belonging to my replica environment in mongodb, I currently have the following configuration:
rs.conf()
{
"_id" : "myreplicaset01",
...
1
vote
2
answers
93
views
Install MongoDB on a drive other than C
During the installation of MongoDB Community 7.0 the installer asks for the paths to the DB, and I point them at the dedicated, 50GB empty drive E:, which was created specially for MongoDB.
The next ...
0
votes
0
answers
48
views
Limit MongoDB Database Size/Quota
I'm running the latest version on Docker(Mongodb server 7.0.11), and I'd like to know: Are there any mechanisms to limit the size of a single database on MongoDB? Or perhaps a way to impose a storage ...
0
votes
0
answers
16
views
In MongoDB sharded env one shard cluster is in 4.2 other 2 shard cluster is on 4.4
We have MongoDB sharded env in k8s having three shard clusters each having three nodes, out of three clusters one cluster is on the 4.2 version and others are on the 4.4 version. How I can upgrade 4.2 ...
0
votes
1
answer
53
views
How to Create a Case-Insensitive Unique Compound Index in MongoDB?
How to Create a Case-Insensitive Unique Compound Index in MongoDB?
Question Body: I'm trying to create a compound unique text index in MongoDB with the following fields:
tenant_id: 1 seller_id: 1 ...
0
votes
1
answer
32
views
If SSTable sorted, why do we need Sparse Index?
As far as I know, when we create clustered index it restructures the table in B-Tree form and uses binary search when we try to find particular row. SSTable is also sorted by key. Why do we need ...
0
votes
0
answers
13
views
Is it possible to add a node which does not have private network connectivity with other nodes?
I have a 3 node replicaset setup
Both have private connectivity with each other and resides on same DC (DataCenter1)
10.1.0.1 - Primary
10.1.0.2 - Secondary
We are planning to have another ...
0
votes
0
answers
22
views
Setting log level for MongoDB
I am looking to set log level to Error(E) for all the components except for the control component which should have the log level set to Informational(I). Also, I would like to log slow queries which ...
0
votes
0
answers
50
views
Mongo DB slow deletes due to indexes rebuild , same with TTL indexes
We are having huge collection which we can not partition ( we need to get the records by last updated time which can not be known ). To decrease the storage we have enabled TTL index based on last ...
0
votes
0
answers
32
views
MongoDB losing / reverting some data
Not quite sure how to handle this. Not even sure it belongs here.
Long story short, I have a MongoDB instance (6.x) running on Win10.
Sometimes, the DB returns some missing values for a document.
Also ...
0
votes
1
answer
38
views
Mongo 3.6 doesn't utilize compound index to avoid in-memory SORT, and 3.4 does
I'm currently experimenting with upgrading mongo, comparing performance of different mongodb versions and stumbled into a curious anomality when upgrading from 3.4 to 3.6.
I have a relatively large ...
0
votes
0
answers
14
views
MongoDB - optimizing compound index by using executionStats
I am visiting the MongoDB learn DBA course. In one of the labs, it was shown how to optimize the compound index by examining the explain plan.
The lab used the sample training dataset. Following query ...
0
votes
1
answer
20
views
Why is my 4-node replicaset setup is not working?
I have a 4 Node setup which is being hosted On-Prem by 2 Host Servers (DC1, DC2)
192.168.0.1 - Primary (Located in DC1)
192.168.0.2 - Secondary (Located in DC2)
192.168.0.3 - Arbiter (Located in DC2)
...
0
votes
1
answer
80
views
Mongod starting issue on ubuntu
When I try to check the status of mongodb I get the following:
× mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
...
1
vote
1
answer
28
views
How to mongodump collection with x days behind?
I'm trying to mongodump one specific collection but I need only 90 days behind. I'd to accomplish something like this:
db.collection.countDocuments({dateStart:{"$lt" : Date.now() - 90*24*60*...
0
votes
0
answers
20
views
MongoDB Schema Design for Branch-Specific Flower Customization without Disrupting Original Data Flow
Description:
I'm working on a MongoDB schema design for a flower shop application where flowers are managed at both the company (flower type) and branch (flower) levels. Each flower type is defined at ...
0
votes
1
answer
194
views
MongoDB Delete old data
We want to clear our Mongo of old records (older than 90 days), we have a replica set with 3 nodes and we have 3.8 terabytes of data (in /var/lib/mongodb) on each node
We want to clear old records ...
0
votes
1
answer
17
views
Hi , Need support to decompose Mongo DB dump - > Then re-construct that again
I am taking Mongo DB Dump from a production server where we have some limitation on file size which can be transferred from production to local environment.
So we are planning to 1)Take Mongo DB Dump ...
0
votes
0
answers
13
views
Zero Access Encryption on AWS, Azure or Google Cloud possible with MongoDB?
I'm having a question about the following: is it possible in general to store data on a cloud platform, specifically either AWS, Azure or Google Cloud, without the cloud provider itself being able to ...
0
votes
1
answer
31
views
Testing a BinData field by $bitAllSet with an offset and size limit in MongoDB
Assume I have a BinData field of arbitrary length that stores n-byte items. The offset of each item is known before the query and all items are n bytes. I want to test an item at offset X with bitmask ...
0
votes
1
answer
42
views
Sharded Cluster - Why does my data not splitted among nodes?
I created a cluster with two shards. Or so I thought. In my design, first server has mongos_router shard1 (3 nodes) and config servers. Second server only has shard 2 nodes. After I configured shards ...
1
vote
1
answer
37
views
Mongo Preventing access to dangerous command
Reading Mongo: Definite guide:
In first chapter, author mentions the following snippet to change some of the default commands of db:
var no = function() {
print("Not on my watch.");
};
//...
0
votes
0
answers
29
views
mongod --storageEngine=mmapv1 is failing
Just started learning MangoDB with the above command which is failing and giving below results.
mongod --storageEngine=mmapv1
Please help me to fix this issue and proceed with my learning and ...
0
votes
0
answers
24
views
When is it most appropriate to use relationships rather than direct embedding in MongoDB?
I'm currently attempting to write some data on MongoDB to store character data, stuff like their name, description, etc. until there it's fine. But I run into situations where to me it's logical to ...
0
votes
0
answers
34
views
MongoDB movePrimary doesn't work when the primary shard is down
We have a sharded cluster with several collections sharded. There are two collections that cannot be sharded because there is a unique index on the collection. So these two collections are on the ...
0
votes
1
answer
23
views
How to setup mongo synchronization with only two nodes?
Im trying to install two nodes of mongo, each one locates in a different location with low latency.
The architecture should be:
One node in DC, and the other node in DR. It is supposed to be only one ...
0
votes
0
answers
35
views
Handling feed and feed subscriptions with document database
I have a data feed that contains channels that users can subscribe to. It's similar to Facebook or LinkedIn where each channel is a topic and users can subscribe to as many channels as they like and ...
0
votes
1
answer
44
views
MONGO_FDW on Postgres user privileges
Setting up MONGO_FDW in Postgres for the first time.
First step is to add the extension after connecting as the default postgres user:
CREATE EXTENSION mongo_fdw;
The application user is app_user, so ...
0
votes
1
answer
30
views
MongoDB composite shard key including timestamp write behavior
I am investigating MongoDB's appropriateness for our use case. We have clients that generate log data, and most of our use cases for this DB involve querying by Client ID and a time range of when the ...
0
votes
0
answers
107
views
MAMP PRO 6.9, PHP 8.2.0, Mac 14.21 and Mongo DB - Apache Fails
Have been trying to get MongoDB installed on MAMP PRO 6.9, PHP 8.2.0, Mac 14.21 via PECL but after a successful install and enabling the extension, when restarting MAMP Pro, Apache fails and none of ...
0
votes
0
answers
39
views
Custom directory for mongodb data
I specified a different directory for my mongodb data in the mongodb conf file:
# Where and how to store data.
storage:
dbPath: /home/psr/data/mongodb
# engine:
# wiredTiger:
# where to write ...
0
votes
0
answers
59
views
The backup I took with mongodb mongodump is extremely slow
I am using mongodb 7 community version. And I have a system that inserts a lot of log documents. Since I am using the Mongodb community version, I cannot use the ops manager tool used in Mongodb for ...
0
votes
0
answers
27
views
Loops not allowed on MongoDB Relational Migrator
Hi I'm trying to use MongoDB Relational Migrator to migrate my postgreSQL DB to MongoDB but I'm getting this message when I try to create a data migration job
Error building job context: loops not ...
0
votes
0
answers
155
views
MongoDb Timeseries Data at high Load Causes Cache Pressure in Time
I'm encountering cache pressure issues in MongoDB, leading to early termination of buckets in my time series collections within a single database. Here's an overview of my system setup and the ...