8 ms·
Show HN: MongoDB Protocol for SQLite
- winrid 3y agoIf this implemented sharding it'd be killer. I recognize that'd be a huge amount of work, but that would be amazing! I may do that someday. You could just use one PG instance as the config servers and this takes place as the mongos.
- peterfarkas 3y agoMaintainer here. That's a very good idea! Let us know if you ever have some time to work with us on this.
- throwaway888abc 3y agoYou should speak to PayloadCMS guys. It can be mutually benefiting (publicity/more users/etc.). It needs Mongo, but if it works with Ferret backed by SQLite (and others) that would be game changer. https://payloadcms.com/ https://payloadcms.com/ Great project of yours! Thank you * will try to hack docker-compose for this if time allows
- peterfarkas 3y agoThank you, we will take a look!
- winrid 3y agoAwesome! This might be my new Sunday project once I'm done with the current one. Mongo's sharding is nice but I'm really tired of their support. They force you to run smaller machines in the contract so they can charge more for # of nodes, and it adds complexity to your architecture so you're swayed into buying Atlas. I could replace it all with a few PG shards with bigger machines.
- peterfarkas 3y agoYes this is one of the reasons we started FerretDB. Atlas is very easy to use, but it is nearly impossible to move away from later on, as there is no alternative (unless you are ready to rewrite your app). We think that most of its killer features, like easy sharding, can be done with Postgres and/or SQLite.
- winrid 3y agoI agree. I'd love to work on this full time if I could.
- _nub3 3y agoMight also be an interesting idea to use sqllite's inmemory feature.
- aleksi 3y agoRight, we are going to add support for it.
- Scarbutt 3y agoMongoDB was originally an eye-opening technology for many of us developers, empowering us to build applications faster than using relational databases. Something something HN and pitchforks.
- Mertax 3y agoIs there any documentation on the native schema used to store the documents. Is it sane enough that you could manually roll your own JSON1 queries in SQL to facilitate more relational join like features?
- aleksi 3y agoSome time ago, we wrote a blog post about it: https://blog.ferretdb.io/pjson-how-to-store-bson-in-jsonb/ https://blog.ferretdb.io/pjson-how-to-store-bson-in-jsonb/ A few details changed after that (for example, type information is not mixed with values anymore), but the general idea is the same. We probably need to document it better. Yes, querying it with SQL should be possible.
- jhatemyjob 3y agoMan this is exactly what I need at a high level but not writing this in C is a complete show-stopper. All that Docker effluvium adds insult to injury. Sad!
- aleksi 3y agoFerretDB is written in Go, can be used as a Go library, and you could call it from C via CGo… But I would not do that :)
- jhatemyjob 3y agoHaha. The thought process behind using Go was probably like: "Great! SQLite is written in C. That means I can write my library in Go! And use microservices!"
- aleksi 3y agoFWIW, we use a version of SQLite transpiled into Go to avoid CGo problems: https://gitlab.com/cznic/sqlite https://gitlab.com/cznic/sqlite
- winrid 3y agoIt's mostly meant as a service. This is a great application for Go.
- mst 3y agoYou can run the underlying single static binary as a service any non-docker way you like. Your applications would be talking to it over a socket using a known and documented protocol so the implementation language isn't something the client code should be expected to need to care about at all. Given those two facts, I genuinely don't understand what your concerns are here?
- Thaxll 3y ago"However, as time passed, MongoDB abandoned its open-source roots; changing the license to SSPL - making it unusable for many open source and early-stage commercial projects." This is not true, you can use MongoDB for commercial projects as long as you don't sell MongoDB services, but internally you're free to use it as your regular DB. https://www.mongodb.com/licensing/server-side-public-license/faq https://www.mongodb.com/licensing/server-side-public-license...
- jcstryker 3y agoThat condition is not in the spirit or commonly accepted definition of open source.
- pnpnp 3y ago“Open source” tends to be a spectrum. For example, many consider GPL to be a great OSS license, but it’s restrictive enough that some BSD projects try to avoid it.
- peterfarkas 3y agoIt tends to be a spectrum, but the various, sometimes very different licenses adopted by the OSI still have something in common - the open source values laid out in the Open Source Definition. [1] SSPL did not comply with this requirement, as it discriminate against specific users or use cases. I think it is in the interest of everyone to draw the line somewhere. [1]: https://opensource.org/osd/ https://opensource.org/osd/
- pnpnp 3y agoBSD would not be OSS by this definition, as it has no clause against discrimination of people. OSS is IMO a very subjective term. There is a massive gray area surrounding open-sourcing derivative works, etc. and other stipulations.
- cyanydeez 3y agoOpen source licenses might be a spectrum but it's likely that the legal reality isn't. Like the famous double split experiment there's probably no spectrum and only a couple of buckets of legal validity.
- vamega 3y agoHas anyone tried running the Ubiquiti Unifi controller against this? Even stories of it being successful with the Postgres backend would be really helpful.
- peterfarkas 3y agoMaintainer here. We will try in the next few days, and I will let you know. I have a lot of Unifi stuff myself.
- vamega 3y agoLet me know if there’s something I can do to help. Running Unifi on NixOS is a bit of a pain since the license means that there is no binary cache for the package, resulting in frequent rebuilds. I’ve also not had a great time with the mongo upgrades in the past that caused my controller to not start.
- adobrawy 3y agoGreat project! I find it intriguing to note a comparable approach by MySQL, where it functions as a NoSQL database, specifically a document database, owing to its adoption of a multi-paradigm methodology. Starting from version v5.7.12, MySQL provides the "MySQL Document Store" feature, which enables data access through a document interface utilizing the proprietary XProtocol protocol. It is important to mention that this protocol is incompatible with MongoDB. The fascinating aspect is that the data can be modified interchangeably using both XProtocol and SQL.
- ctippett 3y agoI started looking into replacing the MongoDB instance used by the Unifi Controller software with this, I need to revisit it.
- vamega 3y agoRelevant comment from someone involved with the project. https://news.ycombinator.com/item?id=36596036 https://news.ycombinator.com/item?id=36596036
- rajamaka 3y agoWow, I have nothing to add except this is exactly what I was looking for prior to abandoning my last project... time to dig it back up again. Amazing stuff.
- yawnxyz 3y agoHonest question: why doesn't Couchdb receive any love on HN? It's such a perfect tool for my side projects and most projects that will never reach Twitter scale
- killingtime74 3y agoFor that scale postgres works very well. Going to need very good reasons to not use it.
- yawnxyz 3y agoPostgres is harder to setup; Using Couchdb can be set up completely in-memory and in IndexedDB as a prototype tool (as PouchDB), then set to sync with a hosted DB somewhere else. For < 10000 user apps, I'd want this flexibility, I think. If I have more than 10k users, I'd have more problems
- gwbas1c 3y ago> Postgres is harder to setup ??? When I used Heroku, Postgres was a checkbox. Can't get any easier than that. I understand that it's more work to set up a schema, as opposed to just dumping data structures into a data store. But, as I described elsewhere in this thread, the flexibility to query any table will help dramatically as your requirements change throughout the lifetime of a product.
- pokstad 3y agoIt did for a while but fell out of favor. Couch doesn’t have any current major endorsements and many companies that used it have moved onto better solutions. Couchbase had most of the momentum and it turned into a different product.
- treis 3y agoIt's a cool idea but everything is just a little funky. At least that's how I remember it when I tried it a while back. That plus all the problems of coding in your DB were the reasons I didn't use it again. Shame too because the sync between couch & pouch was super cool. Feels like the way things should work.
- maxpert 3y agoGreat addition of SQLite backend. I would however love prebuilt binaries for Mac, that way I can test it with Marmot (https://github.com/maxpert/marmot https://github.com/maxpert/marmot sorry for shameless plug). I wanted to build myself but then the instructions in README discouraged it, not sure why, it's not like I am going to train a LLM so it's pretty complex.
- peterfarkas 3y agoThanks for the very relevant plug, we are going to test with Marmot.
- magic_hamster 3y agoIt would be interesting to see some benchmarks, especially comparing the same queries between Mongo and Ferret. Also, while the readme does say it's meant to be a drop in replacement, it does not say whether feature parity has been achieved. I would very much like to see how it fares with an ODM layer.
- xet7 3y agoFeature parity progress with apps: https://github.com/FerretDB/FerretDB/issues/5 https://github.com/FerretDB/FerretDB/issues/5 I presume, that after there is feature parity, then someone could run some benchmarks.
- PeterZaitsev 3y agoThis is fun! Look like SQLite is getting all kind of Network protocols recently What is next ? Will SQLite learn to speak MySQL ? Oracle ?