RavenDB Customers Stories

time to read 6 min | 1200 words

I just got this from a customer, and I think that it is a great story:

Hi Oren,

I thought you might be interested in a little success story!

At the beginning of the year we began pre-financing a pepper factory in the [redacted]. In order to control the money that we were sending to the factory I created a little Excel spread sheet to keep a record of the payments that we were making. However, some payments were made directly from our head office to the factory, and some were made to us in [redacted] which we in turn transferred to the factory. So I added a few more columns to the spread sheet to record this.

However, the repayment calculations are different depending on whether we make the payment in [redacted] or whether it comes from head office. So I added a few more columns to the spread sheet to calculate this. When the money arrives in [redacted], we need to sell the USD at the Central Bank and convert them into [redacted]. So I added a few more columns to the spread sheet to record this.

However, some of the payments that we are transferring to the factory are from money that we borrow locally in [redacted]. So I added a few more columns to record this.  The spread sheet is getting quite big now – we’re at about 30 columns and there’s a lot of horizontal scrolling going on. However, we’ve only done about 10 operations, so there are only 10 rows. No big deal if we have to scroll around a bit.

Now the factory has started to receive the product which we paid for in advance. Good idea if I add a column to record this. Shit – every five minutes, someone comes to me and asks me to add another column for something or other.

OK – these are all distinct operations. When the factory starts to ship out the goods, the first page of the spread sheet is at 45 columns, so I now create a new page in the spread sheet to control the shipments as we receive them. Hmm – another 30 columns appear – of which about a third of them are just references to the first page, and the rest new data.

Now I realize that it would be nice to control our margin on the entire operation. The spread sheet is shared on SkyDrive so that our offices in [redacted] and [redacted], our accountants, our lawyers, the factory and the freight forwarder can see what is going on. However, I can’t allow all of these people to see information about our margins, so I create a new hidden page in the spread sheet.

Boy are we successful – we’ve now done 50 operations. Can’t see the column or row headers any more. No worries, just freeze the columns/headers. Wait a minute – who the hell copied and pasted the formulas to the new rows? The numbers aren’t adding up any more. Duh – why did you put the number for the currency contract in against contract 1234 – it should have gone against 1235??

Now, I don’t want to touch the spread sheet any more for fear of breaking something.

Business is great. We’ve finally nailed how to run pre financing operations for pepper factories in [redacted]. We decide to expand our business, and start working with another factory. Since the data in the spread sheet has to be visible to the factory, I create a new spread sheet. However, some of the requirements are slightly different, so it has different columns to the first one.

Our spread sheet is now 85 columns and 60 rows, and the other one is 78 columns and 7 rows.  Since the second spread sheet “looks” almost identical to the first spread sheet – yup – you guessed it - someone puts information into the wrong spread sheet!

Crisis point – we’ve got about [redacted, but in the millions US$] out in the field, and we can’t work out where the hell the money is – are the goods with the farmer, are they at the factory, are they at the port, are they already on board the vessel,  has the vessel already left? Have we paid for them, if not, when do we need to pay for them?

All the data is in the spread sheet, but only one person in the entire company really understands it  (I just wrote it – I don’t put the data in). So if I want to know something it’s a scream over the desk – “Jonathan where the **** are the goods we were supposed to ship last week?” Jonathan goes on holiday for three weeks.

[redacted] pepper production stops, while Jonathan is going up the Eiffel Tower in Paris. Even at this point – if you can believe this – I was waiting for him to come back so that we could continue operations.

I’ve had enough of this – RavenDB to the rescue! Two – let me repeat that – TWO - hours later, I’ve written the scripts to read the spread sheet(s) and throw them into one document – I’ll repeat that again – ONE document. 

The document is nicely partitioned into logical groups – i.e. classes for Payments, Currency contracts, Shipments etc. There is also a separate class that only does the calculations between the different logical groups. But all of this is stored in one document only. Since the calculations are all obviously read only, the results get persisted to the document.

Two indexes which give me all the information I need to control where the money is, where the stocks are. Three days to write the front end – it only took that long because I’m still learning MVC and javascript (I really wanted to use Backbone, but just couldn’t get my head around it).

In the first analysis of the new application I found [redacted, hundreds of thousands US$] that we had been paid 30 days ago, that we had not sent to the factory, and was lying at the bank!

Now this is where it gets pretty amazing (for me at least). Our data is nicely partitioned, four pages that are simply different views onto the same data. The guys are getting all excited – hey I want to control whether we paid the lawyer etc. Someone notices that some of the calculations are not correct – so much for my edge case tests!

So I add a couple of new properties to the document, create a three line foreach loop to read all the data in the database and save it straight back again, and voila – I’ve “patched” the database. Migrations, shmigrations  - who needs them! All the calculations are updated and stored back in the database, the new properties all appear. And this is all on live data. The minute I’d got the raw data from the spread sheet into the database we stopped using Excel.

And that made my day.