# Upgrade Guide

This document describes breaking changes and how to upgrade. For a complete list of changes including minor and patch releases, please refer to the [changelog](CHANGELOG.md).

## 9.0.0

Legacy range options have been removed ([Level/community#86](https://github.com/Level/community/issues/86)). If you previously did:

```js
db.createReadStream({ start: 'a', end: 'z' })
```

An error would now be thrown and you must instead do:

```js
db.createReadStream({ gte: 'a', lte: 'z' })
```

The same applies to `db.iterator()`, `db.createKeyStream()` and `db.createValueStream()`.

This release also drops support of legacy runtime environments ([Level/community#98](https://github.com/Level/community/issues/98)):

- Node.js 8
- Internet Explorer 11
- Safari 9-11
- Stock Android browser (AOSP).

## 8.0.0

Upgraded to `level-js@5` and `memdown@5` which have the same breaking change:

> Support of keys & values other than strings and Buffers has been dropped. Internally \[`memdown` and `level-js`] now store keys & values as binary which solves a number of compatibility issues ([Level/memdown#186](https://github.com/Level/memdown/issues/186)). If you pass in a key or value that isn't a string or Buffer, it will be irreversibly stringified.

## 7.0.0

Dropped node 6 and removed the defunct `clean` option.

## 6.0.0

Upgraded to `leveldown@5`, `level-js@4` and `memdown@4`, now all based on `abstract-leveldown@6`. For more information please see:

- [`leveldown/UPGRADING.md`](https://github.com/Level/leveldown/blob/master/UPGRADING.md)
- [`level-js/UPGRADING.md`](https://github.com/Level/level-js/blob/master/UPGRADING.md)
- [`memdown/UPGRADING.md`](https://github.com/Level/memdown/blob/master/UPGRADING.md)
- [`abstract-leveldown/UPGRADING.md`](https://github.com/Level/abstract-leveldown/blob/master/UPGRADING.md).

Please note that `leveldown` (which is an optional dependency) now requires node >= 8.6.0.

## 5.0.0

Dropped node 9 and removed `name` parameter from constructor in favor of randomly generated unique names. If you previously did:

```js
const level = require('level-test')()
const db = level('foo', { valueEncoding: 'json' })
```

You must now do:

```js
const level = require('level-test')()
const db = level({ valueEncoding: 'json' })
```

## 4.0.0

We updated `level-js` to `v3.0.0` with changes to browser support, which warranted a new major version.

For more information please see:

- [`level-js/UPGRADING.md`](https://github.com/Level/level-js/blob/master/UPGRADING.md)
- [`level-js/CHANGELOG.md`](https://github.com/Level/level-js/blob/master/CHANGELOG.md)

## 3.0.0

Dropped support for node 0.10.

* * *

If you are using `level-test` with a custom backend, this API has changed.

If you previously did:

```js
var hyper = require('leveldown-hyper')
var level = require('level-test')({ db: hyper })
var db = level('foo', { encoding: 'json' })
```

You should now do:

```js
var hyper = require('leveldown-hyper')
var level = require('level-test')(hyper)
var db = level('foo', { encoding: 'json' })
```

* * *

This contains upgrade to `leveldown@~3.0.0` which is based on `abstract-leveldown@~4.0.0` which in turn contains breaking changes to [`.batch()`](https://github.com/Level/abstract-leveldown/commit/a2621ad70571f6ade9d2be42632ece042e068805).

* * *

Internally this package now depends on `level-packager@2` which in turn is based on `levelup@2` which gives us native Promise support.

```js
var level = require('level-test')()
var db = level()
await db.put('foo', 'bar')
console.log(await db.get('foo'))
```

This does not affect the existing callback API, functionality-wise or performance-wise.

For more information please check the corresponding `CHANGELOG.md` for:

- [`levelup`](https://github.com/Level/levelup/blob/master/CHANGELOG.md)
- [`leveldown`](https://github.com/Level/leveldown/blob/master/CHANGELOG.md)
- [`level-packager`](https://github.com/Level/level-packager/blob/master/CHANGELOG.md)
