Questions tagged [mongodb]

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

Filter by
Sorted by
Tagged with
-1
votes
0answers
5 views

connection string for mongodb from perl script

Connection string for mongodb having 3 node replica set from perl script with ssl true and sslAllowInvalidCertificates Can someone share connection string if you are using it ?
0
votes
1answer
16 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
23 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
0answers
12 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
18 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
27 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
27 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
14 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
31 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
24 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
15 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
38 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
32 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
15 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
18 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
35 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
vote
1answer
50 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 ...
0
votes
1answer
14 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 ...
0
votes
1answer
9 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-...
0
votes
0answers
31 views

Check if a given field exists if the id is known

I have a mongodb collection and i know the id of a document i am interested in. This is how if a field exists in a collection db.properties.find({property_country: "UK"}, {_id: 1}).count() ...
1
vote
1answer
23 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: ...
-1
votes
1answer
30 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 ...
0
votes
2answers
53 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] ...
0
votes
1answer
12 views

filter for elements inside an array

"dammfield" : [ { "_id" : ObjectId("60705d602ba9490026482370"), "f1" : ISODate("2021-04-09T10:57:52.152-03:00"), ...
0
votes
1answer
29 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 ...
0
votes
1answer
27 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': '...
-3
votes
1answer
22 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 ...
0
votes
1answer
27 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 ...
0
votes
2answers
214 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&...
0
votes
0answers
9 views

Will rand string as custom _id make B tree index split higher frequency in MongoDB?

In the answer to the question Are there any advantages to using a custom _id using MongoDB? you can make them more human-friendly, using random strings: t3oSKd9q For the B tree, random key inserts ...
0
votes
0answers
14 views

Backend Server gives Mongo Error not authorized for query on mongo_db.tb_trx when primary is unavailable and Secondary Replica gets elected to Primary

Using mongodb with replica sets, when the primary node fails, one of the secondary gets elected to the primary but the node servers start to throw error Mongo Error not authorized for query on ...
-1
votes
1answer
13 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?
0
votes
2answers
79 views

How to copy MongoDB database from server to local machine?

Or just may be dump database on to the folder on the server and then scp it to local machine? I'm trying to use mongodump from /usr/bin, but nothing good comes out of it, for instance: mongodump --ssl ...
0
votes
2answers
32 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 ...
0
votes
2answers
136 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 ...
0
votes
1answer
79 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 ...
0
votes
1answer
52 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 ...
0
votes
0answers
41 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 ...
0
votes
0answers
13 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 ...
0
votes
1answer
1k 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 ...
0
votes
2answers
243 views

“[ftdc] serverStatus was very slow” - MongoDB 4.0.4

I'm seeing very frequent messages like this in mongod.log and doesn't give an exact reason for the server status was very slow. looks like ftdc logs more information but interpreting ftdc log is very ...
0
votes
1answer
26 views

Zoned and hashed sharding of existing, non-empty collection

I am trying to shard a existing collection. Collection is pretty big (about 100gb). Sharding should be done by 2 fields. First one is zone ['Europe', 'America'] and second one is _id. So my sharding ...
1
vote
3answers
50 views

How to structure db where main records are large

I was wondering if I could ask for some quick opinions. I am prototyping an app which seems simple but I can’t readily arrive at an architecture that feels right. We have data that is simple and fits ...
0
votes
1answer
174 views

Standalone Mongodb suddenly failed and I'm unable to recover. Backups are also corrupt

Running on FreeBSD/ZFS for several months, users reported trouble. At this point I'm out of options so any help is apreciated. The database backs a Node.js based authoring tool with a couple of users, ...
0
votes
1answer
19 views

Does mongo *really* need a dedicated volume, if I need to back it up?

TLDR; What's the easiest way to automate a mongodb backup of a 20-gig DB? We run mongo on the same KVM (VPS) as the web app; the server runs Debian. We/I don't need/want to backup the entire fs on a ...
1
vote
0answers
24 views

MongoDB latency decreases as throughput increases

I am trying to benchmark MongoDB and obtain a throughput vs. latency plot. I am using YCSB as the client and I increase the number of client threads to increase the load on the database. I ...
0
votes
0answers
22 views

What's the easiest way to automate Mongodb backups, for offline storage? [duplicate]

So, I'm almost finished building my first major production web app, and am wondering how to manage backups. Weekly cold snapshot backups via my vps online admin seem ideal - but weekly downtime sounds ...
0
votes
0answers
27 views

Can MongoDB support TTL per document, not per index?

I am trying to do a Redis-like collection in MongoDB. I need a collection of documents that expire and are automatically deleted after a certain time. I can use TTL Indexes but with this, every ...
0
votes
0answers
12 views

Modify number of file WiredTigerLog in mogodb

How can I modify the number of WiredTigerPreplog and WiredTigerLog in journal directory ? There are allways 2 WiredTigerPrepl and 1 WiredTigerLog. Thanks MongoDB : "version": "4.4.4&...
0
votes
1answer
56 views

Rename all databases when doing a mongorestore?

I have a datadump but I need to change the name of every database while restoring them, if a database is named "customers" it needs to be "customer2", "products" to "...

1
2 3 4 5
45