Skip to content

Get raw PK/SK of an item after Entity.create #525

@tmokmss

Description

@tmokmss

Is there any way to get raw PK/SK after creating an item using Entity.create?
My use case is to update an item from Step Functions DynamoDB tasks after creating it using electrodb.

I found the following works but it isn't efficient and requires as any:

    await JobEntity.create({
      jobId,
      status: 'queued',
    }).go();

    const job = await JobEntity.get({
      jobId,
    }).go({ data: 'raw', consistent: true });
    console.log((job.data as any).Item.PK);

Thank you for developing this great library!

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