user4893295
user4893295

Reputation: 651

Mass update of all data with nosql

Trying to get my head around best practice for a full update.

Scenario example is if I'm storing a document for each file on a harddrive. A process runs daily update all the file information. No history needs to be kept of deleted files, the documents can just go.

Clearly querying each record would be inefficient, and wouldn't cover deleted files (data flow is one way only).

So I guess the options are:

1) Store all the records with a timestamp, and then delete all yesterday's records

2) Delete the database, but then I would lose all my views etc

3) Something else?

Upvotes: 0

Views: 585

Answers (1)

Alexis Côté
Alexis Côté

Reputation: 3690

No history needs to be kept of deleted files

If you use one database, every time you will delete your documents, it will keep a tombstone of your documents (which doesn't use a lot of space but still...)

Here's the solution I would use:

  1. Create a Template database with the design documents. Maintain your views there.
  2. Create a script that does the following :

    • Create a database with today's date
    • Replicate _design documents from the template database
    • Add your data to the database

With this solution, each day content can be completely deleted from CouchDB.

Upvotes: 1

Related Questions