Rinat Mukhamedgaliev
Rinat Mukhamedgaliev

Reputation: 5731

MongoDB specific id

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 ?

Upvotes: 1

Views: 390

Answers (1)

Sammaye
Sammaye

Reputation: 43884

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...).

Upvotes: 3

Related Questions