MySQL --> MongoDB: Keep IDs or create mapping? <p>We are going to migrate our database from MySQL to MongoDB. Some URLs pointing at our web application use database IDs (e.g. <a href="http://example.com/post/5" rel="nofollow">http://example.com/post/5</a>) At the moment I see two possibilities:</p> <p>1) Keep existing MySQL IDs and use them as MongoDB IDs. IDs of new documents will get new MongoDB ObjectIDs.</p> <p>2) Generate new MongoDB ObjectIDs for all documents and create a mapping with MySQLId --> MongoDBId for all external links with old IDs in it.</p> <p>2 will mess up my PHP app a little, but I could imagine that #1 will cause problems with indexes or sharding? What is the best practice here to avoid problems?</p>