0

Is there a way to make rethinkdb generate primary key automatically and to ensure the key is in an increasing order., like say 1 to n

I know when we insert a row into rethinkdb it automatically generates a primary key and returns a variable generated_keys, but I want a primary key which increases in a linear fashion say like starting from 4000 to n or 5000 to n, so on.

coderb
  • 27
  • 5

1 Answers1

0

I am not aware if it is possible with RethinkDB. However, I know that it is not a feature that would scale well in a cluster of DB servers as it would introduce a bottle neck in the inserts commands.

It is always possible to do it by hand however, simply by providing an id field to the documents you are inserting in the tables.

Vincent Cantin
  • 16,192
  • 2
  • 35
  • 57
  • Hi Vincent, you are right after googling lot more I figured the response. primary_key is auto generated and starting from a fixed value is not possible, though when we import dataset we can specify some unique field as primary key. – coderb Mar 11 '18 at 01:25