'storing duplicates in Firestore

i currently made a code that allows to import a CSV file into the website,transform it to JSON and then upload it to the firestore database,however in the unique ID that i want to provide for the document names,i have duplicates,because some information in the duplicates are different but i need them none the less,so when there are duplicates firestore only inserts the first document and if it's duplicated it ignores it,my question is,how can i do something that when firestore,finds duplicates,it adds them to a different collection,for example,i have an id called BMW for a collection called cars,BMW will be added to cars collection,then let's say i have 2 more instances of BMW,i want them to be added to the collection called CARS(duplicate)and i want both BMWS to be uploaded into that collection,not just 1,is this achievable? if yes how can i achieve this?, thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source