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

Is “many database writes” an anti-pattern?

I am designing a database api. I have two options: Have a complex aggregation that queries the data as desired or, Create a materialized view that logs all data changes in an easy to query manner and ...
0
votes
1answer
18 views

MongoDB multi-datacenter deployment and shard keys

I am trying to check my understanding after reading docs and some older questions, so my question is quite loaded: In a sharded cluster, each shard should (and as of 3.6 must?) reside on its own ...
-1
votes
0answers
12 views

mongodb 'compact' command crashes db

I deleted a bunch of records from my mongodb database running on Ubuntu 18.04 and I am trying to free up the space on disk with the 'compact' command from the console using: db.runCommand( { compact: '...
0
votes
1answer
11 views

Migrate data from an older version of mongodb

How can I backup and restore a large mongodb database (500GB) from a server running an older version (v2.6) than the target one (v3.6)?. The downtime is critical. We've tried by making a straight copy ...
0
votes
0answers
10 views

How to run a project with 2 MongoDB databases?

I am trying to run a project with 2 MongoDB databases(db1, db2) those are inside a file named dump. I tried the following commands in 2 different terminals inside dump folder: mongod --dbpath=db1 --...
0
votes
0answers
8 views

Mongo Atlas connection issues

I have a Node.js application that connects to Mongo Atlas with a M0 custer running Mongo 4.2 The application previously ran with Mongo Atlas and only after switching the DB to a new cluster did it ...
0
votes
0answers
7 views

Portable DB of Mongodb with Node Js [closed]

I come across USBWebServer, XAMPP have all these bundled for MySQL, Apache Do we have similar like with NodeJs, Mongo, SQLLite I like a portable which can be bundled with application for any quick ...
0
votes
1answer
10 views

How to parse MongoDB int32 in node.js

I am using MongoDB for a discord bot I am working on, and I want to retrieve a user's balance. My current code is function findBalance(id){ MongoClient.connect(url, function(err, db) { if (err) throw ...
-2
votes
1answer
36 views

How to import old mongodb cluster into a new version of mongodb?

If I try to directly copy the data/db folder from an old installation of mongodb to the new one I'm getting this error when I try to start mongod, ** IMPORTANT: UPGRADE PROBLEM: Found an invalid ...
0
votes
1answer
14 views

MongoDB dump oplog based on timestamp

I'm trying to dump oplog.rs from local database, based on timestamp. Query directly from mongo shell works but not from mongodump Query from mongo shell RS1:PRIMARY> db.oplog.rs.find({"ts" : {$gt ...
0
votes
1answer
13 views

using mongorestore for a db present in my computer

I just started using mongodb so my question might be a little basic. I have a folder with the collections I want to restore(this was a zip file I downloaded from my email). How do I use mongorestore ...
0
votes
1answer
22 views

Consequences of increase Oplog to large size

I'm trying to add a new member (m*-server: 4.2.7) in my replica set (m*-servers: 4.2.1), and it can't sync in time, after the initial sync it changes state to RECOVERING and have: (~ 4.3 - 6.31 hrs) ...
0
votes
0answers
13 views

Restore mongodb database from blockstore snapshot backup

I have a situation where I need to restore the mongodb database from the blockstore snapshot backup taken from the ops manager which is used to manage 3 node replica set. I need to restore this backup ...
0
votes
0answers
27 views

how to run db.adminCommand() using pymongo for mongodb 3.6

I want to run this command and get it's output using pymongo module. db.adminCommand({getParameter: 1, logLevel: 1}) or say I want to run this command db.adminCommand( { setParameter: 1, ...
0
votes
0answers
15 views

Backup and upgrade MongoDB databases

I have a web application using MongoDB (Version 2.6.12), hosted in a (Ubuntu 16.04) server of DigitalOcean. I like to use Robo 3T to connect to the remote database and do simple queries. Sometimes I ...
0
votes
0answers
16 views

MongoDB indexing strategy for any subsequence of multiple fields

Let's say I have huge mongodb collection and each element has fields A, B, C, D, E. I want to filter this collection by different groups of this fields like ABC, BDE, AE and so on. Documentation says ...
0
votes
0answers
23 views

MongoDb write performance degradation when increasing the number of concurrent writers

I was testing MongoDb write performance and noticed the following behaviour: when I increase the number of concurrent writers, the average time needed to write a document increases as well and ...
0
votes
1answer
20 views

Mongodb tree structure questions and answers

I'm looking to build a question answer survey system where some questions will be based on the answer of the parent question. The hierarchy level of the questions can go any number of depth based on ...
0
votes
1answer
12 views

mongodump and restore in single command

How to perform mongo DB dump and restore in a single command, by providing source and sink DB and collection name separately? I understand we can do mongodump and then mongorestore but if I need to ...
0
votes
1answer
149 views

MongoDB - Replication Oplog Window has gone below 1 hours

I'm working with MongoDB Atlas and I have a cluster of 3 with M30 and 100gb of storage. My current usecase is the following: - An user dispatches one search in my platform - The platform dispatches ...
0
votes
1answer
22 views

Inserting many documents in collection, but only unique elements, based on specific field

I cannot seem to find an answer on this anywhere. I need the following: Given an array of objects with the structure: { link: 'some-link', rating: 25, otherFields: '..', ...
0
votes
1answer
17 views

How to extract values from a JSON field with Mongodb?

When I run mongdob query I got this json results in a column. Column name is "user" {"email": "mail1@mail.com"} {"email": "mail6@mail6.com", "name": "name1"} {"email": "mail2@mail.com"} {"email": "...
0
votes
1answer
16 views

How to group by and count with mongodb?

I am trying to group by and count with mongodb. Whatever I tried I couldn't do it. This is my query db.getCollection("requests").find( { "updatedAt" : { "$gt" : ISODate("2020-...
1
vote
0answers
24 views

MongoDb has to many open files

When dealing with very large collections i came across timeout issues when querying and inserting. Even though the collections were indexed and optimized to combine small documents together. The ...
0
votes
0answers
13 views

MongoDB Seamless & Complex Data Migration

I am using kotlin spring boot with MongoDB. While enjoying schemaless property of mongoDB, I found out that I denormalized too much in one collection. So I decided to normalize this collection by ...
0
votes
0answers
2 views

Cannot see text after exiting mongodb connection

This is probably linux OS question... But if I press CTRL+C after connection try to mongodb, I cannot see text inserted afterwards [userName@serverName ~]$ mongo admin --host localhost --port ...
0
votes
0answers
8 views

Remove all Node Descendants when remove Node parent in MongoDB

I have data in MongoDB as Tree Structures model. Here is my data: use TreeMongoParent; db.categoriesPCO.insert({_id:"Electronics",parent:null}); db.categoriesPCO.insert({_id:"Cameras_and_Photography",...
0
votes
0answers
15 views

Mongodb replication breaks if balancer started

have a 10 shard ( with 3 replicaset) cluster with very heavy traffic. Storage almost 1.5TB per shard in 2000 databases MongoDB server version is 4.0.3 Since these servers were added at different ...
0
votes
0answers
24 views

MongoDB replica set

I am trying to set a MongoDB replica set. The idea is, having 4 instances in aws: 1 - Nodejs app, a simple webpage, configured to connect to a DB_HOST on port 27017 2 - MongoDB Primary 3 - MongoDB ...
1
vote
1answer
56 views

Saving images as base64 encoded strings, why is it bad?

I've seen this on one of the production databases I've come across and these images apparently cover a large portion of their DB. After researching a lot I couldn't really find a lot of good answers ...
0
votes
0answers
8 views

Can someone explain if I'm desiging my subscriptions mongoDB database model wrong?

I'm creating an application where you can get some FREE CONTENT and the rest of the content is PAID and requires a subscription to access. I'm going to use Braintree as a payment provider to handle ...
0
votes
0answers
6 views

MongoDB Charts Aggregation Pipeline

does anyone know if it is possible to use a fully fledged aggregation pipeline to a MongoDB Chart (cloud hosted charts)? There is a placeholder for the pipeline but it won't parse my projection, ...
0
votes
1answer
16 views

MongoDB: Is it possible to search for two fields whose array sizes don't match?

I have a collection that looks something like the following (I have simplified it a lot). I need to query any record that doesn't have the same number of customersAccepted entries as customersInvited. ...
0
votes
1answer
27 views

Is it possible to detach some specific database from MongoDB Server?

I have to keep several copies of production databases serving by a dockerized MongoDB server. I do NOT want to backup, then to drop, then, when I need it again, to restore it. It is not as quick ...
0
votes
1answer
19 views

Associating large numbers of Items with large numbers of Users in Mongo

Say I have tables Items and Users, which are both in the order of millions. Users can be associated with rows in Items via a 1 to many relationship. This is expected to be on average, a few thousand. ...
0
votes
0answers
9 views

How to simulate a long-running query on a small dataset in MongoDB?

I want to test the maxTimeMS option of the MongoDB NodeJS driver. Queries that take longer than this parameter value should automatically be cancelled by the MongoDB server. How can I simulate a long-...
0
votes
0answers
31 views

What are charted collections in mongoDB?

I'm watching an official mongo aggregation framework tutorial and it mentions that "$geoNear can be used on 'charted collections' where $near can't" (source). I have no idea what a charted collection ...
0
votes
1answer
51 views

Use SHA1 as custom id in mongodb [closed]

I have to save a lot of documents that I'll show on a web and I have a Mongo database to save them. I know that Mongo can autogenerate a random ID for each element in a collection and I also know ...
0
votes
1answer
175 views

Trouble connecting to local MongoDB server through app.js

I'm a newbie to MongoDB, and I just set up MongoDB within my Ubuntu terminal with mongod and mongo commands running in separate terminals. However, I can't get my app.js that would launch a website to ...
0
votes
0answers
17 views

Do I need to create an index on the_id / ObjectId field in a mongodb collection if I want to order or filter documents by their creation date?

The ObjectId value contains a timestamp. Actually, it begins with a timestamp ( https://docs.mongodb.com/manual/reference/method/ObjectId/#ObjectId ). All ObjectId values have a getTimeStamp() method ...
0
votes
0answers
25 views

How to set up MongoDB replica set with podman?

I tried to set up a replica set with podman rootful containers but MongoDB does not accept my members because it does not recognize itself. The podman host address is 10.88.0.1, and MongoDB instances ...
0
votes
1answer
22 views

NOSQL Manager for MongoDB throws command failed collection already exists

While copying collections from one MongoDB server hosted on A to another MongoDB server hosted on B using Copy collection to another database tool of NOSQL Manager we got an error "Command create ...
0
votes
1answer
24 views

Mongo: how to covert a string to decimal?

I have written millions of documents with $CURRENT_CASH_BALANCE as strings instead of decimals. How can I convert them all to decimals?
0
votes
1answer
12 views

Mongodb as windows service

I am using mongo db with replica sets. I am starting the mongodb using command prompt. Python Script: os.system('start mongod --configsvr --dbpath C:\mongoConfigData/configdb1 --replSet conf --port ...
0
votes
0answers
11 views

Mongo DB Cluster activesessions skyrocketing

I have a forked instance of mongod running with the NUMACTL options right now. It is handling 40k - 50k updates per second without issue. I tried migrating this to a sharded cluster and started ...
1
vote
2answers
70 views

How can we use transaction in mongodb standalone connection?

I want to use transaction in mongodb but its told to replicaset can we perform transaction query with standalone mongodb if yes please share how to we can because when I try its give error This ...
0
votes
0answers
12 views

How to migrate MongoDB 2.4.14 file to MongoDB 3.6?

I have a database file from MongoDB 2.4 and we want use this on mongodb 3.6. note: the file is original from the db path. Not from mongodump. This process is messy as it requires doing so on many of ...
0
votes
0answers
21 views

How do I plan out this MongoDB database?

Here's a simple hierarchy of how my data would be stored. jobs/ |---- movie1/ | |---- shot1/ | | |---- shot1_fx/ | | | |---- shot1_fx_v001/ | | | ...
0
votes
0answers
34 views

MongoDB - Update all documents NOT returned in aggregate query

I'm using PyMongo to write a Mongo update script. I have an aggregate query which returns a sum of all searches performed by each user in the last 30 days: cursor = mongo_search_logs_collection....
0
votes
0answers
32 views

Migrate MongoDB 2.4.14 to MongoDB 3.6

I have a database with MongoDB 2.4.14 and I want to migrate the database to MongoDB 3.6. Note: the file is original from the db path. Not from mongodump. This process is messy as it requires doing ...

1
2 3 4 5
43