Categories
JavaScript Answers

How to query for a non-existent (null) attribute in Node DynamoDB?

Spread the love

To query for a non-existent (null) attribute in Node DynamoDB, we calkl the scan method.

For instance, we write

const params = {
  TableName: "Accounts",
  FilterExpression: "attribute_not_exists(email)",
};

dynamodb.scan(params, (err) => {
  if (err) console.log(JSON.stringify(err, null, 2));
  else console.log(JSON.stringify(data, null, 2));
});

to call scan with the params object to make the query.

We query for null value for the FilterExpression field with 'attribute_not_exists(email)'.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *