Mongorestore to Atlas - merge error

Hi there,

I’m restoring a replica set from local to Atlas. It looks like the restore completes but getting the below error. The DB user has full permissions on the cluster, is this error something to be concerned about?

Failed: restore error: error running merge command: (Unauthorized) not authorized on admin to execute command 
{ 
  _mergeAuthzCollections: 1, 
  tempUsersCollection: "admin.tempusers", 
  drop: true, 
  db: "", 
  writeConcern: { 
    w: "majority" 
  }, 
  lsid: { 
    id: UUID("e6ae539f-7131-45ce-a48e-03d0410ca759") 
  }, 
  $clusterTime: { 
    clusterTime: Timestamp(1674472038, 57), 
    signature: { 
      hash: BinData(0, 3C92A7B78CAF115DCE80D2876EAB92DEDA0F0C6A), 
      keyId: 7191796349149380612 
    } 
  }, 
  $db: "admin", 
  $readPreference: { 
    mode: "primaryPreferred" 
  } 
}
2023-01-23T10:45:35.606+0000	73761 document(s) restored successfully. 0 document(s) failed to restore.

Thanks.

Hi @Niamh_Gibbons

As Atlas manages the database users you do not have access to some collection, admin is one of them.

You should exclude the admin namespace when doing the restore:
--nsExclude 'admin.*'

https://www.mongodb.com/docs/atlas/import/mongorestore/#cluster-security

1 Like