3D Access (Key-Value-Versions) Badger / Dgraph

From the blog post - https://dgraph.io/blog/post/badger-over-rocksdb-in-dgraph/

3D Access (Key-Value-Versions)

Badger is probably the only key-value database which exposes the versions of the values to the user. When opening a Badger DB, you can set the options.NumVersionsToKeep . We set this by default to 1 in Badger, but in Dgraph, we set this to infinity.

How can I access the Key-Value-Versions history from within Dgraph…??

Hey @steveducat

How can I access the Key-Value-Versions history from within Dgraph…??

I am not sure what do you mean by history. You cannot access the information about key-value-version from within dgraph. It is not exposed.

You can, however, open the p directory using badger and inspect the contents. If you wish you to access multiple versions of the key, you can create a new transaction using badger.NewTransactionAt(timestamp) https://godoc.org/github.com/dgraph-io/badger#DB.NewTransactionAt (make sure you’ve opened badger in Managed mode OpenManged API) and then creating an iterator with AllVersions set to true in badger.iteratorOptions https://godoc.org/github.com/dgraph-io/badger#IteratorOptions .