7 ms·
Show HN: Monty, Mongo tinified. MongoDB implemented in Python
- loloquwowndueo 5y agoBut is it webscale? :) https://www.youtube.com/watch?v=b2F-DItXtZs https://www.youtube.com/watch?v=b2F-DItXtZs
- davidlatwe 5y agoNot just yet, stay tune for /dev/null based storage engine !
- MaBeuLux88 5y agoIt's already implemented actually :') ! Trust me. I'm an engineer :D. https://github.com/mongodb/mongo/blob/72ed8227aa029afd554aa5809d36529ac145c3e8/src/mongo/db/storage/devnull/devnull_kv_engine.cpp https://github.com/mongodb/mongo/blob/72ed8227aa029afd554aa5...
- the-dude 5y agoIsn't the creator of MySQL named Monty?
- davidlatwe 5y agoYeah, but I didn’t know that at the time I was naming the project. Just a coincidence.:)
- the-dude 5y agoNP, last time I read something from him was around 2000, when he postulated one should just solve referential integrity in your application. Purely coincidental :-)
- davidlatwe 5y agohahaha XD
- ncphil 5y ago... back then, lots of projects were saying referential integrity was an operations problem. That was rubbish, and they knew it. Same for multimaster replication. Fortunately we're past that now. But I like MongoDB for its document model, not its service architecture (although it definitely gets the job done). This Monty is an interesting project, and I'm looking forward to future developments.
- davidlatwe 5y agoThanks for the kind words !
- slver 5y agoIts document model is vanilla BSON on disk.
- avinassh 5y agoIt possible to update the BSON without loading the entire document in the memory? I am curious how Mongo does updates.
- slver 5y agoIt’s a memory mapped file. If you update a bool or number value it’ll rewrite just that. If you update anything else it’ll often have to rewrite the entire document due to variable size.
- MaBeuLux88 5y agoThat was true with MMAPv1. It's not since March 2015, when WiredTiger was introduced with MongoDB 3.0.
- 5y ago
- vorticalbox 5y agoIn nodejs I use mongo memory server[0] for unit testing. Would this be able to fill this gap in python? [0] https://www.npmjs.com/package/mongodb-memory-server https://www.npmjs.com/package/mongodb-memory-server
- davidlatwe 5y agoHmmm, better not using it for unit test I think. Had a quick look into that mongo memory server and it pull the real mongodb instance for testing so it’s solid. MontyDB in other hand is only a tiny in-completed replica (only had basic CRUD implemented, no aggregation and other fancy stuff). Could be used for a quick demo for application that requires MongoDB, which was part of my initiative back then.
- vorticalbox 5y agoThanks, that's a shame I started a new project in python (Fastapi and mongodb) and was looking for something to fill that gap. This still looks awesome.
- davidlatwe 5y agoThanks !
- davidlatwe 5y ago> Could be used for a quick demo for application that requires MongoDB If the demo or production only requires those basic operations of course. Those implemented ops are testing against to real MongoDB, so should be good enough for basic usage.
- watermelon0 5y agoIMO unit tests can be done against any implementation, even a mock one, so using Monty would be beneficial, if it supports all you need. However, you need to have integration tests, to ensure that such implementation behaves the same as the MongoDB version you have in the production. Such tests only need to be run when you change the implementation or upgrade production MongoDB.
- truth_ 5y agoNot a DB expert. Why write a DB program in Python? Wouldn't it be slow?
- CyberDildonics 5y agoYou get the legendary data integrity of mongoDB with the refinement of brand new software running at the speed of python. What's not to like?
- adsharma 5y agoPeople write raft papers with pseudo code or some hard to comprehend systems language. I've always wondered why there isn't a Jepsen tested python implementation with lots of github stars. Here is mine: https://github.com/adsharma/raft https://github.com/adsharma/raft Waiting for a python correctness prover and a transpiler.
- davidlatwe 5y agoYep, it's slow. :) It's not meant to be used in production that has scaled up. This project was mostly for fun.
- truth_ 5y agoThanks. That makes sense.
- emehrkay 5y agoI did the same to learn Redis. I wrote a simple graph database using Gremlin's syntax https://github.com/emehrkay/rgp https://github.com/emehrkay/rgp It was very slow, but interesting.
- divs1210 5y agoInterested to know if it can run on PyPy and what kind of difference that would make.
- blagie 5y agoI would use it in production. It just depends on what I'm producing. "Production" can range from everything like a banking website serving millions (nope) to a kids toy (yup). There are a ton of uses where performance doesn't matter, and some where data is even ephemeral or non-critical. These sorts of simple tools are also really nice for test cases, development environments, and a ton of other uses. I'm developing a tool designed for large-scale data processing, and I have a dummy back-end very similar to this which I use for development. My computer has close to 4GHz and multiple cores. Essentially anything which ran on an 80486 back in the day will be fast enough in interpreted Python. That's actually a lot of stuff. And yes, I'm not disagreeing, but agreeing and expanding on your easily-missed disclaimer ("production *that has scaled up*").
- scottrogowski 5y agoIt's nice but it's no Mongita ;) https://github.com/scottrogowski/mongita https://github.com/scottrogowski/mongita In all seriousness, it seems like there's a lot of demand for embedded Mongo-like databases. Congrats on a successful Show HN post!
- davidlatwe 5y agoThanks ! Yeah, if the job can be done by installing one Python package, why use docker :P
- mysterydip 5y agoIs MongoDB still a recommended production database? The answer seems to change based on what year the question was asked.
- shoo 5y agohttps://jepsen.io/analyses/mongodb-4.2.6 https://jepsen.io/analyses/mongodb-4.2.6 > MongoDB is a distributed document database which claims to offer “among the strongest data consistency, correctness, and safety guarantees of any database available today”, with “full ACID transactions”. Jepsen evaluated MongoDB version 4.2.6, and found that even at the strongest levels of read and write concern, it failed to preserve snapshot isolation. Instead, Jepsen observed read skew, cyclic information flow, duplicate writes, and internal consistency violations. Weak defaults meant that transactions could lose writes and allow dirty reads, even downgrading requested safety levels at the database and collection level. Moreover, the snapshot read concern did not guarantee snapshot unless paired with write concern majority—even for read-only transactions. These design choices complicate the safe use of MongoDB transactions.
- deergomoo 5y agoHah, I love the name. Very clever.