Auto Increment _Id in Spring MongoRepository

1.6k views Asked by At

Is there a way to mimic the @GeneratedValue in MongoRepository?

I would like to auto increment the _id

1

There are 1 answers

0
chrylis -cautiouslyoptimistic- On

Not reliably, particularly since MongoDB doesn't support transactions. The recommended approach is to use a MongoDB ObjectID.