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
4 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 ...
0
votes
3answers
30 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
0answers
46 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
12 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
17 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
18 views

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

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

How to increase number of open connections for mongoDB from clients (C#)

mongoDB v4.0.4 >> replica set of 3 nodes (not sharded) Previously su - mongo7937 No directory, logging in with HOME=/ $ ulimit -Hn 1048576 $ ulimit -Sn 1024 $ cat /etc/pam.d/common-session | ...
0
votes
0answers
11 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
4 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
0answers
28 views

MongoDB - Robo3t: Failed to do query, no good nodes, Field 'cursor' must be a nested object

When viewing documents of a collection and trying to move between pages using "left" and "right" arrow buttons: suddenly started to get the following error in Robo3T: Failed to ...
0
votes
1answer
14 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 "...
0
votes
2answers
18 views

Unable to start mongod daemon after upgrading OS from Ubuntu 16 to 18

Unable to start mongod daemon after upgrading OS from Ubuntu 16 to 18 root@dummy2:~# mongod --version db version v4.0.4 git version: f288a3bdf201007f3693c58e140056adf8b04839 OpenSSL ...
0
votes
1answer
6 views

Mongodb migration and appending data to existing database

I have two databases in two different machines containing data in same schema. Both have relational mappings in form of ObjectIDs as it is done in NoSQL database. The task at hand is to pick one ...
0
votes
1answer
9 views

how to mongorestore mongoDB 4.2 to documentDB 4.0?

I need to do mongorestore from my mongodb 4.2 to DocumenDb 4.0 compatible i got the command from aws which is this mongorestore --ssl --host="abc.aws.com:27017" --username=user --password=...
0
votes
1answer
6 views

threshold replica lag for secondaryPrefered mongod

Example: 3 node on RS with mongos and mongoc(cluster) On one Secondary node(on RS) we have replica lag, e.g. - 1h. So, if my read preference is - secondaryPrefered and if I read data from RS, can it ...
0
votes
0answers
8 views

Mongodb Downgrade issue

I have upgraded mongodb to 4.4 from 4.2 in our dev server(RHEL 8). But unable to downgrade it from version 4.4 to 4.2 (Tried after changing package /etc/yum.repos.d/mongodb.repo). Getting error ...
0
votes
0answers
18 views

Why does the size of fields in a collection in mongodb database affect query performance?

I had a collection that was growing and with it's growth had a crazy increase in query response times. The collection records looked something like this: { orderStat: { type: String }, items:...
0
votes
2answers
24 views

mongo db-Either all host names in a replica set configuration must be localhost references, or none must be; found 1 out of 2 [closed]

while adding secondary member in replica set, i get following error: "Either all host names in a replica set configuration must be localhost references, or none must be; found 1 out of 2" my ...
1
vote
2answers
37 views

Nosql vs sql for genre management

I'm looking to keep a simple database for movies, with details like Name, YearofRelease, Genre etc. The key factor is the genres entry, where a movie could fall into multiple genres. Using a sql based ...
0
votes
0answers
10 views

My Mongos can't authenticate to my replica set

I have 3 config servers in a replica set and when I use the command: sudo mongos --configdb crs/the 3 config servers:port# --keyfile "Keyfile", I keep getting this error: [mongosMain] Unable ...
0
votes
1answer
15 views

mongodump failing to connection replica set

I'm able to connect to secondary node from arbiter node of the replica set. mongo -u backup02 -p backup02_password --port 8133 --host p1dummy:8133,p2dummy:8133,drdummy:8133 --authenticationDatabase ...
0
votes
1answer
19 views

what will happen if MongoDB primary host is down and secondary is out of sync. will we lose transaction?

In our environment, we have one primary(A) and two secondaries(B & C nodes) running in Mongodb 4.0 version. secondary(C) server is newly added and sync is happening on that. Cluster is running ...
0
votes
0answers
23 views

Why mongodb's storage size is larger on secondary than on primary?

I don't understand why the storage size is significantly larger on the secondary than on the primary (450 GB vs 375 GB). hardware, operating system, file system and mongodb configurations are ...
0
votes
1answer
21 views

How to warm a MongoDB index

We're running a huge MongoDB with a large index (made of of four fields) which was created ad-hoc and should now be superseded by slimmer one (of the first two fields). But the problem is we can't ...
0
votes
1answer
38 views

Do you think using ObjectID as field name is a bad practice? What can go wrong if I follow this design?

I design a MongoDB collection where I am planning to use mongo ObjectID as a field name. The ObjectID is a PostID and in the array, I track all the userID who liked or disliked the post.
0
votes
0answers
40 views

How to ETL SQL Server resultset to mongo DB

Let's say I have multiple columns on sql server that I want to join and save the resultset into a single mongodb collection for faster lookup and calculations ( I'm talking about over 15 tables and ...
0
votes
0answers
15 views

Which design could be better for scale a MongoDB query for this usecase

Context Imagine that you have two MongoDB collections, one called nodes and the other called mirrors. Each mirror is replica of a node. So, in case the node is removed (for whatever reason), you ...
1
vote
3answers
37 views

Can't NoSQL DB ensure consistency if it is residing in a single server?

As NoSQL DBs always prefer BASE over ACID. Everyone always says that you can't have ACID when you are working with a NoSQL DBs. For example, we have MongoDB (a popular NoSQL DB), which is hosted ...
-2
votes
1answer
28 views

Are unstructured databases faster using arrays or many binary variables? [closed]

Is it faster (or otherwise better) to structure unstructured data like this: { label:"many_variables_example", "a":0, "b":1, "c":1, "d":1, &...
0
votes
0answers
20 views

MongoDB replica set goes into recovery state after start up

Its a cluster 3 replica. Data size is ~20GB 2 of secondary crashed only node was available is primary and it stopped abruptly and when I started the daemon and is going into recovery. At first I ...
0
votes
1answer
26 views

Which query performs better in MongoDB ($or or $facet)?

I have a query similar to the following; db.getCollection('list').aggregate([ { $facet: { "events":[{ $match: { 'type': 'Event' ...
0
votes
1answer
25 views

Save output of a Mongo Command to a Variable bash script

I have been writing a script to find and kill slow mongodb queries, how can I store output of db.currentOp() in a variable? current I am using this but failing #! /bin/bash out="" mongo <...
0
votes
0answers
13 views

Shell Script to kill slow running Mongo Queries

I need to create a shell script that finds and kills long running mongo queries more than a specified threshold e.g. 15sec I plan to use db.currentOp(); and db.killOp(); to find and kill queries but I ...
0
votes
0answers
9 views

mongoose in node js won't connect to cluster when VPN enabled!

I'm trying to connect my node js app to MongoDB using mongoose. It works well and it connects without any problem. but when I want to connect MongoDB when my VPN is enabled it throws this error: net:...
1
vote
0answers
27 views

How to simulate slow queries on MongoDB

I need to write a shell script that finds and kills long running mongodb queries, but I don't have access to the database that runs slow queries, how to I simulate running slow queries on my local ...
0
votes
1answer
13 views

Mongdb start up warning logging

Mongdb start up warning logging, I see lot questions around these warning in this forum however I wanted to know where does these warnings are logged. I could find them in mongod.log. Can someone ...
0
votes
1answer
51 views

MongoDB Aggregate Poor Index Usage

I've been trying to understand the MongoDB Aggregate process so I can better optimize my queries and I'm confused by usage and $match and $sort together. Sample DB has only one collection people [{ ...
0
votes
0answers
11 views

Append object to document node.js/mongodb

Say I have a mongodb document I'm trying to update. The schema is level1 (object)> level2 (object) > "objects". If I want to add another object to the end, what is the method to do ...
0
votes
0answers
10 views

Appropriate language to write a Script that Kills Long running query MongoDB

I want to create a script that kills queries when they reach specific time threshold, I will be using db.currentOp() method to get information about currently running queries, and use db.killOp to ...
0
votes
1answer
27 views

An exception occurred while opening a connection to the server

I've encountered this from time to time and I cant seem to find the fix. Usually when this error occur, I am seeing increasing number of connections being used while its connection is not being ...
0
votes
1answer
25 views

Unable to start mongod daemon and it looks its crashing

DummyD3 is node3 of 3 node replication cluster. DummyD2 is primary and DummyD1 is Secondary (which is in sync with primary). I tried deleting the data under data path and did rsync from other ...
0
votes
0answers
9 views

Preserve tab and line break while insert JSON string to Document in MongoDB

I'm inserting new document to MongoDB as following: db.crawl_api_config.insertOne({ apiHost: "logbasex.github.io", apiUrl: "20221", contentType: "Blog", ...
0
votes
0answers
36 views

Suggestion for NoSQL database for global users

We are planning to build a social media application, lets say similar to Instagram but at much smaller scale, of course. The users could be from many geographies like US, Europe, Asia who could ...
0
votes
0answers
16 views

Listening to mongodb change streams for indexing to elasticsearch

We have a mongodb 4.0 replica set deployment with a collection that stores social media posts. This table sees a lot activity with updates amounting up to 1000 requests per second occasionally. We ...
0
votes
0answers
39 views

How to disable mongodb cache

I am performing some calculations on datasets and adding some new information to each collection row. I have over 8 billion records in the database. I do not need the cache as I am only going to ...
1
vote
0answers
66 views

Table(s) indexing strategy for separable data [closed]

Scenario: The data needs to be indexed by location, all of the rows include location info and also city info. I want to index by location, but there are millions of rows. The idea is that I can create ...
1
vote
2answers
18 views

how to run mongo export on macbook?

I am using mongodb Atlas (M0), which does not provide db backup feature. I am creating a nodejs script that will export all the collections automatically periodically. So far I have done the following:...
1
vote
0answers
12 views

MongoDB Shema to support concurrent update on a document

We were working on a project with a 300 documents with currentValue field in a main collection, in order to track the history of each document of first collection. we created another collection named ...
0
votes
0answers
27 views

“Document Failed Validation” what is wrong with my schema validation

I am trying to create a collection with JsonSchema (really its "BsonSchema") validation. This is a document that I want to insert (with bogus values). Note that Id is coming from the mongo ...
0
votes
0answers
30 views

MongoDB concurrent update to same document is not behaving atomic

Currently, we have an orderId for which we give the benefit(posting) to the user. There are multiple events that can trigger benefit/posting. But the condition is that only 1 event should be triggered....

1
2 3 4 5
45