Rytis Alekna
Rytis Alekna

Reputation: 1377

Is there a risk of saving document in Mongo with _id from other DB?

I want to save documents to designated Mongo collection from other 3rd party API that uses Mongo too. I want to keep those id's so I would be able to check if I'm not saving duplicates.

Upvotes: 0

Views: 31

Answers (1)

ifiok
ifiok

Reputation: 494

(a) The likelihood is very low, but I will advise against it.

(b) Yes, it is. I can think of modifying it in the pr-save hook of your schema definition. There might also be modules out there for this.

Upvotes: 1

Related Questions