r/mongodb • • Jan 09 '24

Mongodb throughputs are nowhere close to official benchmarks.

0 Upvotes

Inspired by Through the Looking Glass: Analyzing the interplay between memory, disk, and read performance. numbers. I decided to give `mongodb` a test. However, I achieved only 2,000 readouts and 3,000 OPS at peak. Humanly speaking, it took 50 seconds to randomly access 100,000 records (2,000 records per sec throughput), by an index from a database whose cache fully fits into a memory.

How to re-create the environment:

  1. Find M1 Mac, 16 Gb RAM, 1 TB SSD;

  2. Install nodejs;

  3. Download Docker Desktop. Allocate 8 GB of RAM and 10 CPUs in settings;

  4. Spin up a mongo server on docker with enough RAM to cover it's cache size: `docker run --name some-mongo -d mongo --wiredTigerCacheSizeGB 3`

Use the script bellow to prepopulate a database locally with 100,000 documents, 20 kb doc size, and index it by `ref_id`:

import { MongoClient, ServerApiVersion } from "mongodb";
import crypto from "node:crypto";

const uri = `mongodb://mongoadmin:secret@localhost:27017/`;

export const client = new MongoClient(uri, {
  serverApi: {
    version: ServerApiVersion.v1,
    strict: true,
    deprecationErrors: true,
  },
});

const content = crypto.randomBytes(10000).toString("hex");
const article = {
  content,
};

export const fillColl = async coll => {
  let batch = [];
  for (let i = 1; i <= 100000; i++) {
    const _newArticle = JSON.parse(JSON.stringify(article));
    _newArticle.ref_id = i.toString();
    batch.push(_newArticle);
  }
  await coll.insertMany(batch);
};

await client.connect();

const db = await client.db("articles_test_indexed");
await db.dropCollection("general");
const articlesColl = await db.collection("general");
articlesColl.createIndex(
  {
    ref_id: 1,
  },
  {
    unique: true,
  },
);

console.log(`Filling articles_test_indexed`);
await fillColl(articlesColl);
await client.close();

Use the next script to initiate 100,000 random queries using `ref_id` index:

import { MongoClient, ServerApiVersion } from "mongodb";
import { performance } from "node:perf_hooks";

const uri = `mongodb://mongoadmin:secret@localhost:27017/`;

export const client = new MongoClient(uri, {
  serverApi: {
    version: ServerApiVersion.v1,
    strict: true,
    deprecationErrors: true,
  },
});

await client.connect();

const db = await client.db("articles_test_indexed");
const articlesColl = await db.collection("general");

console.log(`Reading 100,000 random records, in articles_test_indexed by 'ref_id'`);
const t0 = performance.now();
const promises = [];
for (let i = 1; i <= 100000; i++) {
  const randomNumber = Math.floor(Math.random() * 100000).toString();
  const promise = articlesColl.findOne({ ref_id: randomNumber });
  promises.push(promise);
}
await Promise.all(promises);
const t1 = performance.now();
console.log(`Total Execution time: ${t1 - t0} milliseconds`);
// Total Execution time: 52492.09483242035 milliseconds, ~52 seconds
await client.close();

Results: Total readout time: ~52 seconds. 2000 reads per 1 second.


r/mongodb • • Nov 02 '21

MangoDB: An open-source MongoDB alternative

Thumbnail
mangodb.io
0 Upvotes

r/mongodb • • Oct 12 '26

I made a lightweight MongoDB GUI for macOS w. Rust (free, open source)

0 Upvotes

Compass was using too much RAM on my laptop, so I built a small alternative as a hobby project.

Heads up: it was written entirely by AI (Claude). I directed and tested it.

You can browse, query, edit documents, export, and use a built-in shell.

https://github.com/yldrmzffr/humon/

Feedback welcome!


r/mongodb • • Oct 09 '23

I chose Mongo but should have chose relational

1 Upvotes

I chose Mongo when I was early on in my software engineering journey for two reasons:

  1. Name sounds cool

  2. Courses I took used it, so had familiarity

Looking back I wish I chose a relational db. It makes more sense for my projects.

Anyone else feel this way?


r/mongodb • • Sep 26 '24

MongoDB vs. PostgreSQL

0 Upvotes

MongoDB and PostgreSQL are two heavyweights in the database world.

  • MongoDB offers the freedom of a NoSQL document-based structure, perfect for rapidly evolving applications.

  • PostgreSQL, on the other hand, gives you the rock-solid reliability of a relational database with advanced querying capabilities.

In this article, I'll write about 9 technical differences between MongoDB and PostgreSQL.

  1. Data model and structure

  2. Query Language and Syntax

  3. Indexing and Query Processing

  4. Performance and Scalability

  5. Concurrency and Transaction Handling

  6. ACID Compliance and Data Integrity

  7. Partitioning and Sharding

  8. Extensibility and Customization

  9. Security and Compliance

Link - https://www.devtoolsacademy.com/blog/mongoDB-vs-postgreSQL


r/mongodb • • Aug 08 '19

Is mongoDB likely to last?

1 Upvotes

The company that maintains it seems to be financially at risk. They have a limited cash supply and seem to lose about $30mil every quarter. I am unsure how they plan on remaining solvent.

Although the technology will live on (it's open source), most companies would be unwilling to adopt an evolving product that is not formally maintained.


r/mongodb • • Apr 11 '24

How did people write complex MongoDB queries before GPT4?

1 Upvotes

r/mongodb • • Jan 22 '25

MongoDB's silent but massive serverless betrayal

Post image
2 Upvotes

r/mongodb • • Dec 27 '23

MongoDB Needs to STOP Advertising Atlas on Every Single Page of The Docs

10 Upvotes

I'm not entirely new to Mongo. In fact, it was the first DB I ever used a few years ago, even before I learned SQL. It's been years since I last used it, but recently I decided to get back into it because it's in demand where I am. And since it's been forever, and I can barely remember anything about the DB, I decided to start again from the beginning.

I opened up the resources tabe on MongoDB's site, I went to check out the courses, I chose the intro course, and the literal first thing that is shoved down my throat, was how to begin with Atlas. Before even any significant mention of wtf a Document is, or BSON, or even basic CRUD operations, or use cases for the DB.

I got tilted, so I decided to go for an old school approach. I thought I'm gonna open the documentation, and like before, start from the beginning. And guess what, once again, on every single page in the introduction, up front and center, there's always a mention and a link to Atlas.

Now IDK wtf people at the company think I want when I look for resources, but it's definetly not endless advertisement for a service for a DB I don't even know how to use yet!

I spent an hour and a half looking up why tf would I want to use Mongo over a relational database, and there are some use cases, but I've also seen a lot of reasons not to. And honestly, if it wasn't for the hype and popularity around the DB, I don't think anyone would want to use it. So if Mongo want to be taken seriously by newcomers and be more than just a buzzword, I think they need to start acting mature and with transparency. (Rant over)

P.S. Yes, I'm still gonna learn the damn thing.


r/mongodb • • Sep 18 '24

What do I do?

1 Upvotes

Let me start this with I am a 15 year old from the US. I decided to mess around with mongodb and max out a server. The invoice was 1,300 and as expected the account was termed. In the email though they said they would send collections, yet I can't even pay that.

Update : It was wiped.


r/mongodb • • Jan 12 '19

AWS DocumentDB - A NoSQL Equivalent For Aurora

Thumbnail
sqlgossip.com
0 Upvotes

r/mongodb • • Feb 08 '17

INSECURE MONGODB CONFIGURATION LEADS TO BOOM IN RANSOM ATTACKS

Thumbnail
anomali.com
1 Upvotes

r/mongodb • • Nov 30 '21

MongoDB Atlas "Conversations"

1 Upvotes

Hey all,

New account, first post. Going to keep it very honest with you, I'm miffed.

I'm looking to gauge your experience with the free support offering by MongoDB Atlas, conversations.

We have had an absolutely shocking time with the support analysts. I accept that we don't pay for support, and do not receive the benefit of SLA's for our service. That said, the issue here is the quality of support we have received, having been absolutely atrocious. Such that I would urge people to think twice about Atlas as an offering. It is fair to say that I am now a detractor of the company.

The issue lies in comprehension.

For several conversations we have opened, the person on the other end of the screen has failed to understand the issue we are experiencing. We have provided context to our issue, screenshots, timestamps, steps to find the issue via the Atlas UI, and results from the server logs that we scrutinized before. We have had to clarify the exact issue, despite it being clear (I asked my peers to review the question because I was incredulous) about 4x per conversation.

For instance we provided clear information displaying how the in-built hardware monitor was missing several critical data points during peak load, and "flatlined" (interpolated) the graphs over a period of 20 minutes or so, we really needed to know what was maxing out / experiencing critical load during that time

It's as though what we say is skim-read, and then applied to a flow-chart for L1 support, and they are woefully equipped to deliver a response when they are not given the opportunity to walk through from their "Start Here" node.

So please, I'm curious, has anyone had better experiences with them? We're hesitant to even entertain the idea of paying for support with our experience thus far...


r/mongodb • • Jan 28 '26

MongoDB has ruined Slashdot

0 Upvotes

The MongoDB ad has been there for months now, I'm fed up of this annoyance done by MongoDB's marketing team and I want you to know that I now dislike MongoDB because of this take over of an old internet property.


r/mongodb • • Apr 19 '25

Ideas for a vibe coding event using MongoDB?

0 Upvotes

Hi everyone! I'm organizing the next local event (MUG) and we plan to do a build battle to create the best project without actually coding using MongoDB, AWS and Cursor.

I hate the word "vibe coding" but that's how people tend to call it, thought I would share the idea and ask for ideas on what cool things we can do, as we have some budget from MongoDB and a venue from AWS.

The main idea is to have teams build for 4ish hours with music, pizzas, etc. and the best team will win whatever the budget will be able to get.

Have you ever been in an event like this? Got some ideas?

Thanks!


r/mongodb • • Oct 16 '25

Chad GPT help me learn Mongo

Post image
3 Upvotes

r/mongodb • • Jun 04 '25

Is MongoDB a Buy or a Sell? Post Earnings Rally in $MDB

Thumbnail
youtu.be
0 Upvotes

r/mongodb • • Feb 01 '17

I hate SQL joins and just setting up mysql databases

0 Upvotes

I am familiar with MySQL and I hate setting up the database, I hate the users part, I hate the schemas, and I hate most of all the SQL joins. Anyone else feel this? I think the joins are the biggest hell.


r/mongodb • • May 10 '20

MongoError: E11000 duplicate key error!

0 Upvotes

Anyone know how to display this on the frontend? Seems impossible. Tried everything.


r/mongodb • • Apr 03 '14

MongoDB Replication Pro-tips: Reporting Instances

Thumbnail
devops.com
0 Upvotes

r/mongodb • • Jan 31 '24

MongooseDB

Post image
0 Upvotes

r/mongodb • • Oct 07 '25

Want to switch to postgresql from mongodb /help

1 Upvotes

Database has grown over 2gb, getting significant error 500 hit on self hosted mongodb. Want to switch to postgresql. Any help needed, suggest resources /anything you now ..


r/mongodb • • May 09 '16

MongoDb is sorting wrong, 1<2 and 2<3 but 15<2 because it sorts 15 as 1.5

1 Upvotes

function _queryPopularPosts($collection){ $filter=[]; $options=['sort'=>['upVote'=>-1]]; return $collection->find($filter,$options);

}

This is the code I use to sort the collection by the number of upvotes, but this is the result I get. The number followed by ^ above the user is the number of upvotes the post has, as you can 15>1 but 15<2. Because it sorts it as 1.5... Anybody has any idea what's the problem?