What are the resources or tools used to manage temporary data in key stores?

I am considering using MongoDB or CouchDB in a project that should support historical records. But I'm not sure how difficult it is to store historical data in these databases.

For example, in his book Developing Temporarily Oriented Applications in SQL, Richard Snodgrass points out tools for retrieving the state of data at a specific point in time, and he outlines how to create schemas that provide reliable data manipulation (i.e., data manipulation, making it difficult to enter invalid data).

Are there tools or libraries that make it easy to query, manage, or define temporary / historical structures for key stores?

change

Please note that from what I hear, the “version” data that is stored in CouchDB is erased during normal use, and since I will need to keep historical data, I don’t think this is a viable solution.

PS There was a similar question that was never answered: key-value-store-for-time-series-data

+3
source share
3 answers

, MongoDB. , , , , .. :

{
    object : whatever,
    date : new Date()
}

, , , . :

db.foo.update({object: obj._id}, {$push : {history : {date : new Date(), object : obj}}})

// make changes to obj
...

db.foo.update({object: obj._id}, {$push : {history : {date : new Date(), object : obj}}})

( ) , , , , . , . , :

{
    object : startingObj,
    history : [
        { date : d1, addField : { x : 3 } },
        { date : d2, changeField : { z : 7 } },
        { date : d3, removeField : "x" },
        ...
    ]
}

, , d2 d3, startObj, x 3, z 7, .

, , :

db.foo.update({object : startingObj}, {$push : {history : {date : new Date(), removeField : "x"}}})
+2

, CouchDB . , UbuntuOne -, , , .

, , , .

CouchDB _update. "history", . , _update , ( ), . , .

, javascript, , , .

http://wiki.apache.org/couchdb/How_to_intercept_document_updates_and_perform_additional_server-side_processing

, .

+1

mongodb, couchdb , .

, , , .

:

:

{ "docid" : "doc1", "ts" : <unix epoch> ...<set of key value pairs> }

:

function (doc) {
  if (doc.docid && doc.ts)
    emit([doc.docid, doc.ts], doc);
  }
}

:

["doc1", 1234567], ["doc1", 1234568], ["doc2", 1234567], ["doc2", 1234568]

start_key end_key.

start_key=["doc1", 1] end_key=["doc1", 9999999999999]

doc1

start_key=["doc2", 1234567] end_key=["doc2", 123456715]

doc2 1234567 123456715 unix epoch times.

. ViewCollation

+1

Source: https://habr.com/ru/post/1726807/


All Articles