diff --git a/docs/api/model/methods.md b/docs/api/model/methods.md index d71b220..88e8d1f 100644 --- a/docs/api/model/methods.md +++ b/docs/api/model/methods.md @@ -40,9 +40,11 @@ The optional params are described in [Model API Params](../params). Find items in the database. This API wraps the DynamoDB `query` method. -The `properties` parameter is a Javascript hash containing the required keys or fields that are used to determine the primary key or keys. +The `properties` parameter is a Javascript hash containing the required keys or fields that are used to determine the primary key or keys. -The sort key may be defined as a simple value or as a key condition by setting the property to an object that defines the condition. The condition operator is specified as the key, and the operand as the value. For example: +When using value templates for key fields, it is preferable to use non-key properties and rely on OneTable to compute the key fields. + +If provided, the sort key may be defined as a simple value or as a key condition by setting the property to an object that defines the condition. The condition operator is specified as the key, and the operand as the value. For example: ```javascript let user = await User.find({pk, sk: {begins: 'user:john'}}) @@ -147,6 +149,8 @@ Get an item from the database. This API wraps the DynamoDB `getItem` method. The `properties` parameter is a Javascript hash containing the required keys or fields that are used to create the primary key. +When using value templates for key fields, it is preferable to use non-key properties and rely on OneTable to compute the key fields. + Additional fields supplied in `properties` may be used to construct a filter expression. In this case, a `find` query is first executed to identify the item to retrieve. Superfluous property fields will be ignored. The `get` method returns Javascript properties for the item after applying any schema mappings. Hidden attributes will not be returned. diff --git a/docs/api/table/methods.md b/docs/api/table/methods.md index bad393d..6c5c5ad 100644 --- a/docs/api/table/methods.md +++ b/docs/api/table/methods.md @@ -121,7 +121,7 @@ The results returned will include hidden properties as they are needed to group async find(modelName, properties, params = {}) -Find an item in the database of the given model `modelName` as defined in the table schema. Wraps the `Model.find` API. See [Model.find](../model/methods/#find) for details. +Find an item in the database of the given model `modelName` as defined in the table schema. Wraps the `Model.find` API. See [Model.find](../../model/methods/#find) for details. ## get