Mongorestore failed to create index when restoring data.

  mongodb, question

I first backup data from the local LAN to the local, the command is as follows:
mongodump -h –port 27017 -d SmallPark -o /home/guo/mon2
Then restore the local data to Amazon server
mongorestore -h –port 27017 -d SmallPark –drop /home/guo/mon/SmallPark
However, this kind of mistake will be reported when recovery is made.
Error creating index SmallPark.parkusers: 197 err: “The field ‘safe’ is not valid for an index specification. Specification: { unique: true, key: { smallId: 1 }, name: “smallId_1”, ns: “SmallPark.parkus…”
Many watches will report this error.

According to the error you posted, smallId in parkusers is a unique index, but the same value exists in the collection.

You can check your data or cancel the unique index of the corresponding collection.