Tag: dynogels

当列表可能不存在时,DynamoDB ConditionExpression检查列表

我试图把条件放在列表中的第一个项目上,当列表可能存在也可能不存在。 我正在尝试检查列表是否首先存在,但是DynamoDB似乎没有将expression式短路。 不pipe:ValidationException:提供的expression式指的是一个在项目中不存在的属性。 params.ExpressionAttributeNames = { '#checkIns': 'checkIns' }; params.ExpressionAttributeValues = { ':newCheckIn': [newDateString], ':justDatePart': justDatePart }; params.UpdateExpression = 'SET #checkIns = list_append(:newCheckIn, #checkIns)'; // make sure task is not already checked in today params.ConditionExpression = 'attribute_not_exists(#checkIns) OR (NOT begins_with(#checkIns[0], :justDatePart))'; return Table.updateAsync({ID}, params); // using dynogels-promisified 我似乎无法通过检查该属性是否先存在而使其短路。 此外,我试图用if_not_exists()用一个无意义的stringreplacecheckIns [0],但我得到这个错误: ValidationException:无效ConditionExpression:条件expression式中不允许使用该函数; 函数:if_not_exists 有人有主意吗?

Dynogels:使用OR比较的查询

我正尝试将以下scans优化为单个scan (或query )。 我看到的唯一方法是使用DynamoDB使用OR比较器 。 我在我的应用程序中使用dynogels (fork of vogels ),但遗憾的是我没有意识到任何OR查询function。 let arrivals = yield Reservation.scan() .where('room').equals(room) .where('arrival').between(from, to) .execAsync().then((reply) => reply.Items.map((item) => item.get())); let departures = yield Reservation.scan() .where('room').equals(room) .where('departure').between(from, to) .execAsync().then((reply) => reply.Items.map((item) => item.get())); let combined = arrivals.concat(departures); return Promise.resolve(combined); build议的优化: return Reservation.scan() .where('room').equals(room) .where('arrival').between(from, to) .or.where('departure').between(from, to) .execAsync().then((reply) => reply.Items.map((item) => item.get())); […]