Question

I can't find how to setup format "id" in MongoDB. I use SpringData Mongo and see id not normal. I want do id as postgres "BIGSERIAL" and auto increment. Anybody know how do it ?

Was it helpful?

Solution

There is a good reason why MongoDB does not do auto incrementing IDs and if you don't for some reason require them I would recommend not using them personally.

That aside you can create an auto increment IDs as shown in the Documentation: http://docs.mongodb.org/manual/tutorial/create-an-auto-incrementing-field/

It will not be "BIGSERIAL" but it will be auto incrementing (provided you manage it...).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top