Show HN: Monty, Mongo tinified. MongoDB implemented in Python
github.com
github.com
Purely coincidental :-)
But rewriting the document is more extensive, it might even have to be moved (because Mongo allocates certain number of bytes for it, and it might outgrow that).
In all seriousness, it seems like there's a lot of demand for embedded Mongo-like databases. Congrats on a successful Show HN post!
Would this be able to fill this gap in python?
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.
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.
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.
This still looks awesome.
This differentiation is quite pointless though. If you can spawn the dependency in memory at no cost then why not.
Also not using dependencies is not the point of a unit test. Almost everything has dependencies.
It's a common mistake that people think that HTTP implementations can't be unit tested too, but the truth is a bit more complicated. These libraries are essentially a wire protocol and people think of them as 'wire-protocol' instead of 'wire, protocol'. If you think of it instead as a codec with IO, then you write the codec separately and you can fully test the codec without mocking any IO at all.
It's nearly tautological that code that is written to be unit tested can be unit tested, and code that isn't cannot be. And because people want to get their code 'working' and then prove that it works, they are battling uphill to get good tests written, because good tests can't be written. And then some people use this as confirmation bias for why they shouldn't have to write tests.
Don’t confuse how it’s done with what is done.
People get suck a kick out of categorizing their tests, I honestly find that funny.
Can you run it easily before you commit code to a unit, without a dedicated setup? Yes, then it's a unit test to me.
If it was me I wouldn't call it "something" test at all. It's just automated tests. The rest is mostly BS.
If you have to test scenarios in which other dependencies are needed, then you must move up the testing pyramid. That serves to put in check the expectations of what each type of test should accomplish, and when to execute those tests.
Why write a DB program in Python? Wouldn't it be slow?
Here is mine:
https://github.com/adsharma/raft
Waiting for a python correctness prover and a transpiler.
It's not meant to be used in production that has scaled up. This project was mostly for fun.
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*").
It was very slow, but interesting.
This is the same as the problem with electron. People that only know javascript might think it is great to embed a full web browser, but it is selfish to users to push something that they think will run at a normal speed only to have it use 100x the memory and lag during simple operations.
https://news.ycombinator.com/item?id=27032399
Please file bugs/issues if something isn't working.
(Edit: to be clear, I'm agreeing with you)
Long term, complicated, high performance projects worked on by many developers is the Achilles heel of Python. The lack of type safety really bites over a large code base. Also issues with automatic refactoring tools due to the very dynamic nature of Python Deployment and dependency management is also a big issue in Python. Not to mention performance and multithreading.
And God forbid someone mention the L1 cache and how "benchmarks" are completely different to the cache interactions in real-world dynamic programs.
* That it's a dynamically typed language * That it's not a serious language like C or C++, suitable for writing a 50 line throwaway script
I'd like to convince people that both statements are false. But probably best to use the github issue tracker than HN comments.
> 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.