I am ingesting data from CSV using java-api. I have to maintain the primary key of each document.
Does marklogic provide any unique auto-generated id during insert ?
If marklogic do not provide then i can think of one thing which is random generated hexString number but problem is if i have large number of record in CSV to ingest, sometime this random number might repeat.
Please suggest me how to proceed with this use case.
The advised approach is to use the randomly generated ID values, of sufficient length that the chance of collision is impractical for your data set size. Because you're human you're still going to be tempted to check for collisions, but math says it's simply wasteful. If you're using a 64-bit random value then you have 50/50 odds of a collision after 4 billion. Too risky? Use a 128-bit random value if that's worrisome because then it's 50/50 odds after 18 quadrillion. See "Probability of 64-bit hash code collisions"