Ad
DynamoDB Get Item But Only If An Attribute In That Item Is False
So I have a an item I only want to get if its not set to be deleted.
Is it more efficient to sort it away in Node after I have fetched it? I cannot find any conditions in the documentation in the get call to dynamodb. How do I approach this scenario?
Ad
Answer
You can set in params isDeleted:false. Doing so you can filter by any attribute you want, not only by isDeleted. See the example:
var AWS = require("aws-sdk");
AWS.config.update({
region: "us-west-2",
endpoint: "http://localhost:8000"
});
var docClient = new AWS.DynamoDB.DocumentClient();
var params = {
isDeleted : false
};
docClient.query(params, function(err, data) {
if (err) {
console.error("Unable to query. Error:", JSON.stringify(err, null, 2));
} else {
console.log("Query succeeded.");
}
});
Is that what you're looking for?
Ad
source: stackoverflow.com
Related Questions
- → Maximum call stack exceeded when instantiating class inside of a module
- → Browserify api: how to pass advanced option to script
- → Node.js Passing object from server.js to external modules?
- → gulp-rename makes copies, but does not replace
- → requiring RX.js in node.js
- → Remove an ObjectId from an array of objectId
- → Can not connect to Redis
- → React: How to publish page on server using React-starter-kit
- → Express - better pattern for passing data between middleware functions
- → Can't get plotly + node.js to stream data coming through POST requests
- → IsGenerator implementation
- → Async/Await not waiting
- → (Socket.io on nodejs) Updating div with mysql data stops without showing error
Ad