Questions tagged [mongodb]
All versions of MongoDB - a scalable, high-performance, open-source, document-oriented database.
2,341
questions
0
votes
0
answers
13
views
What are the time complexity of MongoDB operations? (Or where I can find it)
I'm newbie in MongoDB, I'm deciding how to make the schema. And I found that people usually don't separate models in mongo, join everything in the same record. So in order to decide if I will or not ...
0
votes
1
answer
25
views
How to disable mongosh logging?
I'm using mongosh v1.1.7 and I'd like to disable logging (these ones) because it's taking up all my disk space.
How can I do that?
I found a similar question but it only applies to mongo
0
votes
0
answers
9
views
MongoDB configuration with custom resource definition
I am using Custom Resource Definition from MongoDB community to deploy a MongoDB ReplicaSet in one K8s cluster. I am facing a problem between the members of the replica. They all have the same ...
0
votes
1
answer
40
views
MongoDB Server on Ubuntu Crashes again and again
The mongodb server on my ubuntu Virtual Private Server Crashes on regular basis.
mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor ...
0
votes
0
answers
15
views
Implement Competing Consumers using MongoDB?
I am just learning MongoDB and considering using it to implement competing consumers over messaging queues (i.e. pubsub). What are my options to efficiently do so? Is MongoDB's concurrency model ...
0
votes
1
answer
23
views
Is there a way for mongodb clients to connect to mongodb server (SSL/TLS enabled) without client certificates?
I am trying to setup a MongoDB with SSL/TLS enabled. I'm just wondering is there a way for clients to connect to my mongodb server without having a client certificate that would not compromise the ...
0
votes
1
answer
23
views
Upgraded mongodb 2.6 -> 3.6 and seeing errors: "Sessions collection is not set up..."
I had a replica set running on MongoDB version 2.6 and upgraded to 3.6 (2.6 -> 3.0 -> 3.2 -> 3.4 -> 3.6).
The cluster is working fine for my normal operations.
rs.result()
...
"ok&...
0
votes
1
answer
18
views
Import big mongodb bson archive > 300Mb
I've installed mongodb the next way on Ubuntu 20.04:
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/...
1
vote
1
answer
62
views
Allow connection to mongo only from my server droplet
Recently I created a server with MongoDB preinstalled on a DigitalOcean droplet following these tutorials
DigitalOcean - Initial server setup
DigitalOcean - How to secure MongoDB on Ubuntu
Medium - ...
1
vote
0
answers
20
views
MongoDB Hybrid Cloud deployment on-premise first capable?
We have multiple on-premises with a MongoDB instance for each and want to sync some collections between those instances.
It should also be possible to add a private cloud instance in the best case.
...
0
votes
0
answers
14
views
upgrading mongodb cluster. Is there a table for mongos (MongoDB Shard Utility) compatibility?
I need to upgrade mongodb cluster There are many applications accessing mongodb using mongos (MongoDB Shard Utility)
I need to know which versions are compatible In other words, can I install mongos 6....
0
votes
1
answer
24
views
Is id in all table a good schema design for MongoDB?
We are designin User and Order collection.
In our User collection, we already has DBRef referencing to Order collection but our manager asked us adding an extra field in the order collection.
...
0
votes
0
answers
24
views
mongodb is not distributing data evenly among shards
I have a database with 800k objects and I defined about 13 shard servers to access the data quickly. I assigned a letter to each object for use in the sharding process, for example, shards: 'a' for ...
-1
votes
1
answer
22
views
Real Time Analytics: Which database?
We are currently using MongoDB, and it is performing well for our needs. However, we are looking to support better real-time analytics and aggregations, which MongoDB doesn't handle effectively. ...
1
vote
0
answers
8
views
MongoDB Timeseries unusably slow queries after deletion and re-creation
My measurements:
I have 3 measurement types, a lot of assets, and data with timestamps. The size of the timeseries grows by ~5GB / month after compression.
My timeseries collections:
I had a blank ...
1
vote
1
answer
23
views
How to make data in a sharded collection move away from a shard
I have a sharded collection with 3 shards (shard1, shard2, shard3). Each shard is a 3-node replicaset (rs1, rs2, rs3).
I have a db called activity that has a large sharded collection called items. ie( ...
0
votes
0
answers
37
views
MongoDB Index Size Growth on updateMany()
When I update an indexed field, the size of the indexed field changes drastically. What's the reason behind this? (Indexed fields are 'result' and 'address.city' and they both have the same value in ...
0
votes
0
answers
10
views
Increase in Dirty Cache in Mongodb when we added a new replica set member
Mongo Version: 3.6
Database Engine: Wiredtiger
Old Cluster:
1 Primary
1 Secondary
1 Arbiter
We wanted to replace the secondary with a new machine, so we added a new Replica set. Due to which the ...
0
votes
0
answers
19
views
MongoDB addShard doesn't add a new shard to the cluster
I have a MongoDB cluster of 2 nodes. The 2 nodes are hosting each:
one config server
one shard server
one mongos instance
When I connect to the machine 1 on a mongos and execute:
sh.status()
I can ...
0
votes
2
answers
500
views
How to install mongodb 3.6 on ubuntu 22.04
Installing mongodb 3.6 on ubuntu 22 keeps throwing this error!!
The following packages have unmet dependencies:
mongodb-org-mongos : Depends: libssl1.0.0 (>= 1.0.2~beta3) but it is not installable
...
0
votes
0
answers
34
views
MongoDB Atlas - Unknown Connections spikes from private IPs
I have a MongoDB cluster running on Atlas. We connect each client to MongoDB by passing an appName with that we know who connects to the cluster and we can identify them.
At some points, we get a huge ...
0
votes
0
answers
15
views
What will happen if I create another, hashed, index on the _id field?
What happens if a field has 2 indexes, a hashed one and the default b-tree one?
Specifically, what happens if I create an additional hashed index on the _id field, which by default is indexed?
When I ...
0
votes
0
answers
15
views
Best way to have a snapshot of cosmosdb (MongoDB API) database running in production to use in development purpose
We need to create an snapshot from the production database, which is under cosmos dB (MongoDb API), to be used in a development purpose.
To do so, we have create a backup using continuous mode, and ...
0
votes
1
answer
27
views
Mongo shell: is it possible to add a custom function to cursor?
In the command line tool mongosh, is it possible to add a custom function and I can use it this way:
>db.somecollection.myCustomFunc()
1
vote
0
answers
54
views
How to use mongoexport with a dynamic variable for date on windows batch file?
Here is my working script:
mongoexport --db db1 --collection Transaction --out C:\Users\Admin\transactionstats.json --query="{"PaymentDate":{"$gte":{"$date":"...
0
votes
0
answers
29
views
NoSQL : MongoDB : Design Collections for Countries and Generic Translations
We have a countries collection, where default language is English, containing the ISO 3166.
Country document information can change over the time (ISO standards can change).
Maybe adding "...
0
votes
0
answers
45
views
MySQL or MongoDB, which is more costly and by how much?
I have a dataset of 5 million customers where READ is the most critical operation (avg READ would be 100K rows every half hour). Each customer record contains typical personal information.
What are ...
0
votes
0
answers
51
views
Simple dynamic questionnaire creator design in MongoDB?
I've been researching and trying to learn how to create a dynamic survey builder architecture in Mongo by reading through the documentation and searching online for a while, but I'm still having ...
0
votes
0
answers
32
views
Is there a way of identifying transaction boundaries from MongoDB ChangeStream?
The MongoDB documentation (https://www.mongodb.com/docs/manual/reference/change-events/) specifies that for a change event, the transaction associated with that event can be uniquely identified by the ...
0
votes
0
answers
15
views
Adding view to mongodb creates malformed archive
Yesterday I added a new view to a mongodb 6 database. The view itself works but when I tested the backup archive today with mongorestore on a different machine/database I got
Failed: restore error: ...
1
vote
1
answer
69
views
Product Object for Ecommerce in NoSQL
I'm working on an ecommerce app that will be using a NoSQL document database. I want to have a general purpose product that can be used for different types of products, ranging from coffee to ...
0
votes
1
answer
60
views
How to restore Mongodb db with collection.wt and index.wt files
I have collection-0-xxx.wt and index-0-xxx.wt files simply copied from another dbpath.
I am wondering if those files are enough to restore the data in MongoDB. If yes, how can I do that? If not, what ...
0
votes
2
answers
1k
views
Unable to use Mongodb in NodeJS
I am trying to work with MongoDB in Node.js but it is not working even with the simplest code.
The Simplest Code:
var url = "mongodb://localhost/mydb";
/*also tried "mongodb://...
0
votes
2
answers
123
views
Why did writes stop working when a secondary in my replica set went down?
I have a MongoDB replica set with 3 nodes and 1 arbiter.
The nodes have priority 0, 1, and 10. The arbiter has priority 1. They all have 1 vote.
The priority 10 was PRIMARY, while the priority 0 and 1 ...
0
votes
0
answers
32
views
This is a question about how to recover mongodb composed of shards
The current situation is that the db is corrupted by killing and raising the process using linux command kill rather than the normal method of mongodb.
If I had used the shutdown command, it would not ...
2
votes
0
answers
528
views
MongoDB Find query returning error, no idea why
I am learning MongoDB by myself. I am following all the official guides as well as watching videos and I am practicing on a movie database. Each document has an array "crew" with a "...
0
votes
0
answers
151
views
Application can't connect to MongoDB server through IP address
I have a java application that connects to mongoDB 4.0.2 replicaSet with one node (Primary). I upgraded the database to mongoDB 4.2.20. Even though, after making tests I decided to downgrade to 4.0.2. ...
0
votes
0
answers
51
views
MongoServerError: Document failed validation
I have this collection on Atlas Mongodb. I am testing updating the records in this collection using the mongosh tool on Ubuntu Focal Fossa and it previously worked on my work network but now produces ...
3
votes
1
answer
108
views
WiredTiger Page Size
I'm unable to find out if there is a pagesize in a WiredTiger MongoDB storage engine.
I mean some analog of the innodb_page_size for MySQL.
1
vote
1
answer
2k
views
MongoDB :: using String instead of default ObjectId type for _id?
There is this question which asks essentially the same question but is three questions in one and the 1/3 I'm after isn't really answered very well so I'm asking it again:
I'm starting an new MongoDB ...
0
votes
0
answers
811
views
Can not start MongoDB community edition on Mac
Following Install MongoDB Community Edition on macOS:
Started like this: brew services start mongodb-community@6.0
no error was raised, but when I do: brew services list
kukodajanos@Kukodas-MacBook-...
2
votes
1
answer
23
views
Does hidden priority-0 replica count when calculating fault tolerance?
We have a mongdodb cluster with 3 replicas in one. We are planning to add one more replica on cloud. The replica on cloud is set as hidden and priority-0. If we include the hidden the total no. of ...
3
votes
1
answer
38
views
Manually change hidden node to primary when all other nodes fail
We have a setup MongoDB cluster that consists of a total of 5 nodes of which 3 are on-premise and 2 nodes on cloud server. We have configured 2 nodes on cloud servers to be hidden and priority-0 to ...
0
votes
0
answers
20
views
How can I prevent UX issues caused by a document that references another document changing?
I have a web application that utilises two collections in a MongoDB database:
Ingredients
Recipes
An example of the problem
A chef creates a new recipe, which is added to the Recipes collection.
...
2
votes
1
answer
14
views
MongoDB operations rate by collection
Is there a way to get an operation count/rate by collection or database?
I know about mongotop command, but it's quite different. Also, it seems collStats has no information I am looking for.
1
vote
1
answer
14
views
Run mongoimport in a complete isolation
We planning our data migration from one standalone server to other standalone server. (we can't use replication due to some constraint)
We had used fsyncLock() and fsyncUnlock() to ensure complete ...
0
votes
0
answers
59
views
Mongo Atlas conversion for Replica Set to Shard without downtime
Need to convert live mongo db atlas replica set to sharded. But seems it will have downtime. Because its changing structure of cluster.
I tried with username/password and certificate based auth for ...
0
votes
1
answer
233
views
Mongodb replica stuck at STARTUP
I have 4 Servers:
Mongo1(with secondary and arbiter), Mongo2(primary).
Mongo3, Mongo4
Mongo1 and Mongo2 were initiated and successfully running for months.
(1 and 2 + arbiter are connected over the ...
0
votes
0
answers
51
views
Accidentally drop of collection on shard of sharded MongoDB cluster
I have accidentally triggered a drop collection command on one replica set (primary-shard) of a MongoDB sharded cluster (no secondary shards). Unfortunately now I can not access the data of this shard ...
0
votes
0
answers
104
views
mongodb - composite shard key involving identifier and date
We have a collection of data which records the activities performed over a range of time period. the fields of importance are userid and created_at
many of the users are pretty important in our system ...