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

**URL:** <https://discuss.dgraph.io/t/3d-access-key-value-versions-badger-dgraph/6252>\
**Category:** Dgraph\
**Created:** [April 5, 2020, 6:51pm UTC](https://discuss.dgraph.io/t/3d-access-key-value-versions-badger-dgraph/6252 "2020-04-05T18:51:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![steveducat](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@steveducat](https://discuss.dgraph.io/u/steveducat)\
**Post date:** [April 5, 2020, 6:51pm UTC](https://discuss.dgraph.io/t/3d-access-key-value-versions-badger-dgraph/6252/1 "2020-04-05T18:51:42Z")

</div>

From the blog post - [Why we choose Badger over RocksDB in Dgraph - Dgraph Blog](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…??

---

<div class="post-metadata">

**Author:** ![ibrahim](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ibrahim/32/6387_2.png) [@ibrahim](https://discuss.dgraph.io/u/ibrahim)\
**Post date:** [April 6, 2020, 3:06pm UTC](https://discuss.dgraph.io/t/3d-access-key-value-versions-badger-dgraph/6252/2 "2020-04-06T15:06:31Z")

</div>

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)` [badger package - github.com/dgraph-io/badger - Go Packages](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` [badger package - github.com/dgraph-io/badger - Go Packages](https://godoc.org/github.com/dgraph-io/badger#IteratorOptions) .
