Skip to content

Commit

Permalink
Add docs for new consistent parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
sam3d committed Jan 4, 2025
1 parent 1151425 commit fdec1be
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 38 deletions.
1 change: 0 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2537,7 +2537,6 @@ export interface QueryOptions {
logger?: ElectroEventListener;
data?: "raw" | "includeKeys" | "attributes";
order?: "asc" | "desc";

consistent?: boolean;
}

Expand Down
2 changes: 2 additions & 0 deletions www/src/pages/en/queries/batch-get.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ By default, **ElectroDB** enables you to work with records as the names and prop
listeners Array<(event) => void>;
preserveBatchOrder?: boolean;
attributes?: string[];
consistent?: boolean;
};
```

Expand All @@ -124,3 +125,4 @@ By default, **ElectroDB** enables you to work with records as the names and prop
| listeners | `[]` | An array of callbacks that are invoked when [internal ElectroDB events](/en/reference/events-logging) occur. |
| logger | _none_ | A convenience option for a single event listener that semantically can be used for logging. |
| preserveBatchOrder | `false` | When used with a [batchGet](/en/queries/batch-get) operation, ElectroDB will ensure the order returned by a batchGet will be the same as the order provided. When enabled, if a record is returned from DynamoDB as "unprocessed" ([read more here](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchGetItem.html)), ElectroDB will return a null value at that index. |
| consistent | _none_ | When set to `true`, DynamoDB will return the most up-to-date data reflecting updates from all prior write operations using DynamoDB's [`ConsistentRead`](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html#HowItWorks.ReadConsistency.Strongly) parameter. Strongly consistent reads are only supported on tables and local secondary indexes. |
24 changes: 13 additions & 11 deletions www/src/pages/en/queries/get.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,19 @@ By default, **ElectroDB** enables you to work with records as the names and prop
logger?: (event) => void;
listeners Array<(event) => void>;
attributes?: string[];
consistent?: boolean;
};
```

| Option | Default | Description |
| --------------- | :------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| params | `{}` | Properties added to this object will be merged onto the params sent to the document client. Any conflicts with **ElectroDB** will favor the params specified here. |
| table | _(from constructor)_ | Use a different table than the one defined in the [Service Options](/en/modeling/service#options) |
| attributes | _(all attributes)_ | The `attributes` query option allows you to specify ProjectionExpression Attributes for your `get` or `query` operation. As of `1.11.0` only root attributes are allowed to be specified. |
| data | `"attributes"` | Accepts the values `'raw'`, `'includeKeys'`, `'attributes'` or `undefined`. Use `'raw'` to return query results as they were returned by the docClient. Use `'includeKeys'` to include item partition and sort key values in your return object. By default, **ElectroDB** does not return partition, sort, or global keys in its response. |
| originalErr | `false` | By default, **ElectroDB** alters the stacktrace of any exceptions thrown by the DynamoDB client to give better visibility to the developer. Set this value equal to `true` to turn off this functionality and return the error unchanged. |
| response | `"default"` | Used as a convenience for applying the DynamoDB parameter `ReturnValues`. The options here are the same as the parameter values for the DocumentClient except lowercase. The `"none"` option will cause the method to return null and will bypass ElectroDB's response formatting -- useful if formatting performance is a concern. |
| ignoreOwnership | `false` | By default, **ElectroDB** interrogates items returned from a query for the presence of matching entity "identifiers". This helps to ensure other entities, or other versions of an entity, are filtered from your results. If you are using ElectroDB with an existing table/dataset you can turn off this feature by setting this property to `true`. |
| listeners | `[]` | An array of callbacks that are invoked when [internal ElectroDB events](/en/reference/events-logging) occur. |
| logger | _none_ | A convenience option for a single event listener that semantically can be used for logging. |
| Option | Default | Description |
| --------------- | :------------------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| params | `{}` | Properties added to this object will be merged onto the params sent to the document client. Any conflicts with **ElectroDB** will favor the params specified here. |
| table | _(from constructor)_ | Use a different table than the one defined in the [Service Options](/en/modeling/service#options) |
| attributes | _(all attributes)_ | The `attributes` query option allows you to specify ProjectionExpression Attributes for your `get` or `query` operation. As of `1.11.0` only root attributes are allowed to be specified. |
| data | `"attributes"` | Accepts the values `'raw'`, `'includeKeys'`, `'attributes'` or `undefined`. Use `'raw'` to return query results as they were returned by the docClient. Use `'includeKeys'` to include item partition and sort key values in your return object. By default, **ElectroDB** does not return partition, sort, or global keys in its response. |
| originalErr | `false` | By default, **ElectroDB** alters the stacktrace of any exceptions thrown by the DynamoDB client to give better visibility to the developer. Set this value equal to `true` to turn off this functionality and return the error unchanged. |
| response | `"default"` | Used as a convenience for applying the DynamoDB parameter `ReturnValues`. The options here are the same as the parameter values for the DocumentClient except lowercase. The `"none"` option will cause the method to return null and will bypass ElectroDB's response formatting -- useful if formatting performance is a concern. |
| ignoreOwnership | `false` | By default, **ElectroDB** interrogates items returned from a query for the presence of matching entity "identifiers". This helps to ensure other entities, or other versions of an entity, are filtered from your results. If you are using ElectroDB with an existing table/dataset you can turn off this feature by setting this property to `true`. |
| listeners | `[]` | An array of callbacks that are invoked when [internal ElectroDB events](/en/reference/events-logging) occur. |
| logger | _none_ | A convenience option for a single event listener that semantically can be used for logging. |
| consistent | _none_ | When set to `true`, DynamoDB will return the most up-to-date data reflecting updates from all prior write operations using DynamoDB's [`ConsistentRead`](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html#HowItWorks.ReadConsistency.Strongly) parameter. Strongly consistent reads are only supported on tables and local secondary indexes. |
Loading

0 comments on commit fdec1be

Please sign in to comment.