Questions tagged [mongodb]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
85 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": { &...
user avatar
0 votes
0 answers
52 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-&...
user avatar
0 votes
1 answer
61 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 ...
user avatar
  • 101
0 votes
0 answers
29 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 ...
user avatar
  • 1
2 votes
0 answers
70 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 ...
user avatar
0 votes
1 answer
78 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 ...
user avatar
  • 94
0 votes
0 answers
65 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 ...
user avatar
  • 101
1 vote
1 answer
29 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 ...
user avatar
  • 94
0 votes
1 answer
48 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 ...
user avatar
0 votes
0 answers
62 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&...
user avatar
0 votes
1 answer
250 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&...
user avatar
  • 111
0 votes
0 answers
30 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 ...
user avatar
0 votes
0 answers
14 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 ...
user avatar
  • 94
0 votes
0 answers
46 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....
user avatar
0 votes
1 answer
436 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 '...
user avatar
  • 115
0 votes
0 answers
48 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"), "...
user avatar
0 votes
1 answer
1k 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 ...
user avatar
0 votes
0 answers
37 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 ...
user avatar
0 votes
1 answer
31 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 ...
user avatar
  • 101
0 votes
1 answer
57 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 ...
user avatar
  • 94
0 votes
0 answers
19 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", ...
user avatar
0 votes
1 answer
149 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 ...
user avatar
  • 94
1 vote
0 answers
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 ...
user avatar
0 votes
1 answer
67 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', ...
user avatar
0 votes
1 answer
54 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=...
user avatar
  • 94
0 votes
1 answer
38 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 ...
user avatar
1 vote
2 answers
224 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 ...
user avatar
  • 94
0 votes
0 answers
36 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-...
user avatar
1 vote
1 answer
911 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()) ...
user avatar
  • 117
1 vote
1 answer
85 views

How to figure out what's happening with mongodb?

I am facing an issue where our primary instance of mongodb shows high memory consumption every night. & i was going through the metrics and could see the cache size being reduced and used memory ...
user avatar
0 votes
1 answer
72 views

Queries on Mongo Secondary are not equally distributed

I have a MongoDB cluster setup with one primary and 2 Secondaries in a single shard setup. Every night we have a high load but one day and most of the read APIs have a SECONDARY_PREFERRED read ...
user avatar
0 votes
1 answer
36 views

MongoDB 4.4 Enterprise and Kerberos Authentication

I am trying to setup Kerberos authentication to work with MongoDB Enterprise 4.4. My OS is Centos 8. I have configured SELinux as described in https://docs.mongodb.com/manual/tutorial/install-mongodb-...
user avatar
1 vote
1 answer
756 views

Can I delete manually data files for entire database in MongoDB

I like to optimize my backup strategy of my MongoDB. I have dedicated folders for each database: storage: dbPath: /mongodb directoryPerDB: true journal: enabled: true wiredTiger: ...
user avatar
-1 votes
1 answer
263 views

find a problem into mongodb cpu usage in mongodb atlass

Since a few days ago, resource usage of the database has increased a lot when we don't have a new query is added to the system I am asking for help on how to solve the problem And, I received the ...
user avatar
0 votes
2 answers
663 views

Does the order of MongoDB search terms matter for query performance?

Does the order of search terms in MongoDB matter? I came across this documentation from learnmongodbthehardway that cautions against the use of $ne and $nin: If you need to use these [$nin and $ne] ...
user avatar
  • 133
0 votes
1 answer
23 views

filter for elements inside an array

"dammfield" : [ { "_id" : ObjectId("60705d602ba9490026482370"), "f1" : ISODate("2021-04-09T10:57:52.152-03:00"), ...
user avatar
  • 7,114
0 votes
1 answer
41 views

Do any pattern exists for renaming live a MongoDB collection?

Do any pattern exists for renaming a MongoDB collection live in production environment? The collection is accessed both for reading and for writing in a non sharded environment. The requirement is to ...
user avatar
  • 131
0 votes
2 answers
256 views

Get the list of all the users of all the databases using pymongo

db.command('usersInfo') The above command gives the list of users in the database in which the command is run. command_result = db.command( { 'usersInfo': {'user': 'user', 'db': '...
user avatar
-3 votes
1 answer
60 views

How to arrange documents in a collection alphabetically in mongodb?

How do I arrange my document names in a collection alphabetically and henceforth make my searches for a particular document faster? Say I have a million documents in a collection. I want to search for ...
user avatar
0 votes
1 answer
115 views

Concerns with Frequent Updates in MongoDB

I am trying to maintain near real-time digital twins of IoT devices. Some research has pointed to Eclipse's Ditto framework built on top of a MongoDB database. Being unfamiliar with database ...
user avatar
  • 1
0 votes
2 answers
3k views

for mongo, not able to create users other than admin with error command createUser requires authentication :

This is the script I am using to create user accounts in MongoDB: mongo <<EOF use admin; db.createUser({user:ram", pwd: "ram123!", roles:['root']}); db.createUser({user:"sam&...
user avatar
-1 votes
1 answer
15 views

Search with mongodb [closed]

Im learning mongodb and Im starting the searching commands but looking for an example i found this db.amigos.find({Nombre: "Marisa" },{Nombre:1, Apellidos:2}) What does :1 and :2 means?
user avatar
  • 1
0 votes
2 answers
919 views

How to copy MongoDB database from server to local machine?

I need to dump database on to the folder on the server and then scp it to local machine. I tried the below methods: mongodump --ssl -u root -p password --authenticationDatabase name -d databaseName -o ...
user avatar
0 votes
2 answers
179 views

Is there an automatic way for a secondary member to promote to primary member in a replica set?

Here is my setup: Node 1 = 10.1.0.1 (Primary) - priority 1 Node 2 = 10.1.0.2 (Secondary) - priority 1 Node 3 = 10.1.0.3 (Secondary) - priority 0 In the event of Node 1 failure, Node 2 will be set to ...
user avatar
  • 59
0 votes
2 answers
1k views

how to disable access to mongo shell to anonymous users?

i have created users in mongodb . one user among them is admin. but when i do $mongo it is allowing me to connect to mongo shell with out me specifiying user and password. what should i do to prevent ...
user avatar
0 votes
1 answer
355 views

MongoDB: F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/data1/mongodb/log/mongod.log"

I am trying to install mongodb 3.4 on Redhat 7.9. When I start mongodb systemctl start mongod I get the below error FileNotOpen: Failed to open "/data1/mongodb/log/mongod.log, But when I start ...
user avatar
  • 1
0 votes
1 answer
61 views

Map-Reduce on `system.profile` collection

I have a simple collection posts with a few documents in it. I have set the profiling level to 2 allowing for profiling information to be collected into another collection system.profile. My goal is ...
user avatar
0 votes
0 answers
106 views

How to speed up the mongo query for getting the min and max values in range?

I have a simple collection that contains two fields: timestamp and value (float). I need to get min and max values in the timestamp range. The collection contains approx 10000000 documents. I've add ...
user avatar
0 votes
0 answers
27 views

PostgreSQL for user management and another database for file management (Blob storage)

I am working on a project with video hosting and online editing platform with a microservice architecture in mind. One of my teammates uses PostgreSQL SQL for user management, but I need to handle ...
user avatar
  • 1
0 votes
1 answer
5k views

mongod.service: Failed with result 'exit-code'

I'm trying to run mongodb server : sudo systemctl start mongod this gives me no error, but when I try to check the status, I get error saying : mua@mua  ~  sudo systemctl status mongod ...
user avatar

1 2
3
4 5
47