Firestore didn't go well for me.

 

I decided to use my lockdown project SUDSJS.com to test out a few different NOSQL database management systems (DBMS).  

SUDSJS is written in JavaScript using the node.js server-side system and I designed it so that I could plug in different drivers for different databases. I wrote database drivers for MySQL, SQLite 3 and PostgreSQL. The first NOSQL system I tried was MongoDB, and the SUDSJS.com test site is currently running using this. The second NOSQL system I tried was Firestore from Google. 

It didn't go well.

It turns out that the Internet is full of workarounds for the features that an SQL developer expects. And they are features that SUDSJS needs. 

For example, assume you have a collection of people, and you want to extract a list of people whose business is in retail and are in the UK, you just need: business= 'retail'. and country='UK. This is not a problem, but if your query includes an 'or' the problems start. You can do business='retail' or business='wholesale'.  However, if you want business='retail' or country='UK' it's hard luck.  Can't do it.   

The Firestore evangelist can (and do) say "that's not a problem, just do two queries and concatenate the results".  If you want a sorted list, you have to sort the result yourself.  If you want the first 5 items from a list of 10,000 you have other problems.  

There are other things you want to look for: value > 10 and value < 50 that if fine, but value > 10 and satisfaction >2 doesn't work.  

Another practical issue is that Firestore requires that composite queries have a pre-created index. Otherwise, it throws a hissy fit (above).  The error message helpfully gives a link so your sysadmin can easily create the index. But SUDSJS allows users to create their own query, so there are a large number of queries possible - most of which probably won't come up.  Calling up database support to request an index is not going to make the user popular.

At this point I quit. I have a database driver that 'kind of' works for Firestore but it will never be ready for prime time. 

Firestore is not targeted at classic database applications. Its strengths are in distributing data to multiple mobile devices and has very cool capabilities for things like local caching.  There are applications for which this is the ideal solution. But I don't see this as a replacement for general-purpose database management systems. 

On to the next database. I think Cassandra, although the documentation looks challenging.  Maybe CouchDB.

SUDSJS code is on GitHub

No comments:

Post a Comment