by mdavidn · 6y ago · 0 comments
Or 1678 password protected databases with one or more human readable files in them and let CouchDB handle user auth, which CouchDB makes really easy.
You could do the same thing with a simple flat file database using directories and files and system level user access, and it'd be very fast too.
This is pretty much the kind of thing CouchDB is designed for though and has tools built-in to make it easy.
This is exactly the kind of thing that SQL database is shine at and noSQL databases do poorly.
No, I've not. I just never liked the way it worked so I have to honest and open about my prejudice.
> This is exactly the kind of thing that [...] noSQL databases do poorly.
That's really not true. I've built web apps that do pretty much exactly what that voting apps does and I use CouchDB to do it because it was built specifically for this kind of thing, and it makes it very easy.
That's not the same as saying SQL won't work. Or even that it's a bad choice by design if it's what you're familiar with and good at using it.
How much time have you spent with CouchDB?
I do know that those coming from a long history of using SQL dbs often have a hard time using CouchDB. I had a hard time with SQL, so maybe it's a right brain/left brain kind of thing. Or maybe it's just not really wanting to learn a different way to do what you already know how to do with a different tool.
I chose to use a hand rolled flat file database early on (around 2000) as a backend for my web apps. When CouchDB hit v1.4 I switched to it because it worked very much the same as my db and offered a lot of advantages. It's gotten a lot better over the years since too.
So yeah, my view comes from a different perspective.
I've used CouchDB on and off for some years[1], although I've used SQL databases for longer. I've also used NoSQL databases ranging from MongoDB to Cassandra, Hadoop, BDB (and variants), DynomoDB, etc.
CouchDB (or any other NoSQL database) just isn't the best choice here. The application is literally tables of relational data with multiple simultaneous users which is pretty much the perfect use case for a SQL Database Server.
[1] Since 2010! Wow that's a lot longer ago than it seems. https://mail-archives.apache.org/mod_mbox/couchdb-user/20101...
But in a voting application structuring the data is actually very very helpful, it keeps bad data out, and helps with auditing.
What happens when two people share authentication (which will happen!) and access the app at the same time. Maybe you are going to try and implement file-locking, yourself, badly?
SQL has literally been used for this kind of app since the 1980s. It's simple to use, and easy to find developers who use it.
If they both come from a different district and log into CouchDB they'll either only write to their file (one db, multi-user) or write to a file (or files) in their db (db per user).
If two users write to same file in same the db at the same time the DB will note the conflict and decide which data gets stored in the file.
https://docs.couchdb.org/en/stable/replication/conflicts.htm...
Yes, this is how I remember CouchDB working. It leaves the hard parts of conflic resolution up to the client app:
Once you have retrieved all the conflicting revisions, your application can then choose to display them all to the user. Or it could attempt to merge them, write back the merged version, and delete the conflicting versions - that is, to resolve the conflict permanently.
You do realize that SQL databases handle this automatically via locking schemes and transaction, right?