Skip to content

Commit

Permalink
fix: tracking when the entire document is loaded
Browse files Browse the repository at this point in the history
Dyngoose tries to track when the entire document is loaded, so it can
be intelligent about tracking updated and removed attributes to perform
update operations.

This was breaking when loading a request without a projection, which is
the default behavior.
  • Loading branch information
benhutchins committed Oct 14, 2023
1 parent 8fc23a8 commit e22902a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/query/primary-key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export class PrimaryKey<T extends Table, HashKeyType extends PrimaryKeyType, Ran
const getGetInput: Partial<PrimaryKeyGetGetItemInput> = input == null ? ((range == null || isKeyValue(range)) ? {} : range as PrimaryKeyGetInput) : input
getGetInput.key = record.getDynamoKey()
const getItemInput = this.getGetInput(getGetInput as PrimaryKeyGetGetItemInput)
const hasProjection = getItemInput.ProjectionExpression == null
const entireDocument = getItemInput.ProjectionExpression == null
let dynamoRecord: GetItemOutput

try {
Expand All @@ -167,7 +167,7 @@ export class PrimaryKey<T extends Table, HashKeyType extends PrimaryKeyType, Ran
}

if (dynamoRecord.Item != null) {
return this.table.fromDynamo(dynamoRecord.Item, !hasProjection)
return this.table.fromDynamo(dynamoRecord.Item, entireDocument)
}
}

Expand Down

0 comments on commit e22902a

Please sign in to comment.