[SERVER-80299] Cannot use mongodump on db v7.0.0 Created: 22/Aug/23  Updated: 17/Oct/23  Resolved: 17/Oct/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 7.0.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Josh Kirk Assignee: Alison Rhea Thorne
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Triage
Operating System: ALL
Steps To Reproduce:

Use `mongodump v100.8.0` on a db of version `7.0.0`

Participants:

 Description   

Dumping a v7.0.0 db with `mongodump` version `100.8.0` gives

 

```2023-08-21T09:18:15.777+0100 Failed: error creating intents to dump: error creating intents for database config: error getting collections for database `config`: (Unauthorized) not authorized on config to execute command { listCollections: 1, filter: {}, cursor: {}, lsid:

{ id: UUID("5552942c-94f3-4c0b-ac87-63c67b236814") }

, $db: "config" }```

I believe this is expected as `mongodump`s [latest docs](https://www.mongodb.com/docs/database-tools/mongodump/#mongodb-server-compatibility) do not advertise support for the latest db version. Presumably this requires `mongodump` to be updated.



 Comments   
Comment by Alison Rhea Thorne [ 17/Oct/23 ]

Hello! In regards to our mongodump documentation, I'll be talking with our tools team to see if an update is required. That said, as you have resolved the matter involving your backups, I'm going to close this issue.

Comment by Josh Kirk [ 25/Aug/23 ]

Hi Christopher,

I have managed to get `mongodump` working.

It seems that the roles `userAdminAnyDatabase` and `readWriteAnyDatabase ` do not give permission to use `mongodump`. So I ran `db.grantRolesToUser("admin",["backup"])` and now I can dump.

As in my initial issue, the `mongodump` docs do not specify MongoDB v7.0.0 support although it is supported (https://www.mongodb.com/docs/database-tools/mongodump/#mongodb-server-compatibility)

Comment by Josh Kirk [ 24/Aug/23 ]

Hi Christopher,

Thank you for your reply. Is the documentation simply out of date if it is working on your machine? In which case the issue may be isolated to me rather than a version problem.

  • The DB only has one user, myself (`admin`), which is set to be an admin:

```
admin> db.getUsers()
{
  users: [
    {
      _id: 'admin.admin',
      userId: new UUID("9cbea00c-8cef-447b-84c6-003d475c1db8"),
      user: 'admin',
      db: 'admin',
      roles: [
        { role: 'userAdminAnyDatabase', db: 'admin' },
        { role: 'readWriteAnyDatabase', db: 'admin' }
      ],
      mechanisms: [ 'SCRAM-SHA-1', 'SCRAM-SHA-256' ]
    }
  ],
  ok: 1
}
```

I believe these admin roles are a superset of the `backup role` and shouldn't be an issue?

  • Prior to migrating to Ubuntu 20.04 Mongo 7.0.0 I used MongoDB 6.0.6 on a mac which was able to run `mongodump` with `mongodump` version `100.7.2`. I'm not sure if this provides any insight

Josh

Comment by Chris Kelly [ 23/Aug/23 ]

Hi joshkirk@duck.com, thanks for your report.

I tested this myself on MongoDB 7.0.0 and Mongodump 100.8.0 for Ubuntu 20.04 using m to spin up a 3 node replicaset. I inserted some documents into the config database and in other databases, and did not run into a permissions error running mongodump locally.

Some asks:

  • This looks like a permissions error on the user used for mongodump. Can you confirm which permissions you are providing for the user running mongodump? For example, see our Built-in backup role.
  • If your permissions are correct, can you also confirm whether you tested this on an older version? If so, when did it last work for you, and how did you run it?

Christopher

Generated at Thu Feb 08 06:43:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.