Configuring the Range and Direction of the Cursor

Learn cursor configuration options to set the direction of the cursor’s iteration.

The direction property

We can set the cursor’s direction when traversing through the data in the object store. The direction property can be one of the following values:

  • next: The cursor is moving forward, from the beginning of the object store to the end.

  • prev: The cursor is moving backward, from the end of the object store to the beginning.

  • nextunique: The cursor is moving forward but only yielding records that do not have duplicate keys.

  • prevunique: The cursor is moving backward but only yielding records that do not have duplicate keys.

Example

 Let’s create an example to use the cursor to loop the data in reverse order.

Get hands-on with 1200+ tech skills courses.