# mongorestore: Failed: db.coll: error restoring from dump: E11000 duplicate key error / unsupported BSON version

**Code:** `mongorestore: failed to restore (duplicate key / BSON / version)` · **Category:** MongoDB · **Seen on:** MongoDB, Linux

`mongorestore` couldn't load some documents — they already exist, indexes conflict, or the dump/server versions don't match.

## Meaning

Use `--drop` to replace existing collections, `--nsInclude/--nsExclude` to restrict, and keep tool and server versions compatible (restore with an equal or newer `mongorestore`). Duplicate-key errors mean documents already exist; index failures happen when unique indexes conflict with data.

## Common causes

- Target already has the documents (no --drop)
- Unique index conflicts
- Tools older than the server version
- Dump taken with different `--gzip`/archive options
- Insufficient privileges (restore role)

## Quick fix

1. `mongorestore --drop --gzip --archive=dump.gz`
2. Use matching or newer tools
3. Grant the `restore` role to the user

## Detailed fix by platform

### Linux

1. `mongorestore --uri "mongodb://user:pass@host/?authSource=admin" --drop --gzip --archive=backup.gz`

## How to diagnose

1. **Existing** — Docs already there?
2. **Version** — Tool vs server?
3. **Role** — restore?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/mongodb/mongorestore-failed-version-or-duplicate)
