Hi Ayende,
We are storing a Statistics document for some of our entities:
E.g.: entity/1/statistics
{
"Shares": 0,
"Votes": 0,
"Comments": 15,
"Score": 0,
"Trending": 0,
"Views": 542
}
- Score and Trending are calculated by a Scripted Index.
- Comments and Votes are updated by another Scripted Index.
- Views and Shares are stored in PostgreSQL and updated outside RavenDB, using two different background jobs through the Patching API.
If I understood your comment this is a big no-no…!
My understanding is that there’s no recovery when a Scripted Index update fails due to concurrency errors. So, do we need to keep 4 different statistics documents for each entity?
One to update Score and Trending (first Scripted Index), another for Comments and Votes (second Scripted Index), a third one to store the Views and a fourth one to store the Shares?
Thanks