Skip to content

Docs and playground disagree about where version gets added to index. #526

@erysPath

Description

@erysPath

Describe the bug

The docs say that the version get added to the primary key when using composite indices, but in playground is gets added to the sort key.

ElectroDB Version
Current docs and playground

ElectroDB Playground Link
This is the example linked from the docs on indexes.

Entity/Service Definitions
Include your entity model (or a model that sufficiently recreates your issue) to help troubleshoot.

const stores = new Entity({
  model: {
    entity: "stores",
    service: "malldirectory",
    version: "1"
  },
  attributes: {
    storeId: {
      type: "string",
      label: "sid",
    },
    mallId: {
      type: "string",
      label: "mid",
    },
    buildingId: {
      type: "string",
      label: "bid",
    },
    unitId: {
      type: "string",
      label: "uid",
    }
  },
  indexes: {
    locations: {
      pk: {
        field: "pk",
        composite: ["storeId"]
      },
      sk: {
        field: "sk",
        composite: ["mallId", "buildingId", "unitId"]
      }
    }
  }
}, { table: "your_table_name" });

Expected behavior
Docs say the indexes should look like

  "pk": "$mallstoredirectory_1#sid_storevalue",
  "sk": "$mallstores#mid_mallvalue#bid_buildingvalue#uid_unitvalue"

But playground has

        "pk": "$malldirectory#sid_storevalue",
        "sk": "$stores_1#mid_mallvalue#bid_buildingvalue#uid_unitvalue"

Docs have the version on the primary key, but playground has the version on the sort key. Which is the actual production behavior?

Errors

N/A

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions