Comments (11)
please try this.ConsumedCapacity inside the callback
DynamoDB
.table(tableName)
.where('partitionKey').eq(partitionValue)
.where('sortKey').begins_with(sortValue)
.query(function(err,data) {
console.log(err,data, this.ConsumedCapacity )
})
from dynamodb-oop.
Im getting null value.
from dynamodb-oop.
I see, I'll have a look at it today and get back to you
from dynamodb-oop.
Hi,
I've published 0.1.51 which defaults to 'TOTAL' for ReturnConsumedCapacity
you can override with return_consumed_capacity('NONE') // 'NONE' 'INDEXES' 'TOTAL'
Also added it to documentation
Please re-open the issue if you're still getting null
Thanks
from dynamodb-oop.
version: "0.1.64"
Still getting: consumed: null
DynamoDB
.table(dynamoTable)
.where(key).eq(value)
.return(DynamoDB.NONE)
.return_consumed_capacity('TOTAL') // 'TOTAL' / 'INDEXES' / NONE
.insert_or_replace(tmp_data, function (err, res) {
if (err) {
return callback(err)
} else {
//console.log( 'update result:', err, res )
console.log('consumed:', this.ConsumedCapacity)
return callback(null, res)
}
})
from dynamodb-oop.
Hi teebu,
there was a recent but resetting ConsumedCapacity after each call,
I've published 0.1.66 that has it fixed
Thanks.
from dynamodb-oop.
Yes that fixed it. Keep up the great work.
from dynamodb-oop.
How do you get consumed capacity when using async?
async function getItem(table, key, value) {
return DynamoDB
.table(table)
.return_consumed_capacity('TOTAL') // 'TOTAL' | 'INDEXES' | NONE
.where(key).eq(value)
.get()
}
const res = await getItem('table', 'id', '123')
console.log(res) // only contains the returned data
from dynamodb-oop.
Heyy,
I dont have a solution for return_consumed_capacity() when using async
If you have any ideas please let me know
from dynamodb-oop.
No good ideas. Maybe add a method to the returned item so it doesn't actually change the returned object's data?
from dynamodb-oop.
yes, that could be a solution, something like .return_raw_result(true)
from dynamodb-oop.
Related Issues (20)
- Expression error when using a having('key').between(1, 10) HOT 10
- update or insert is modifying my data object HOT 4
- Raising an issue to tell ... HOT 1
- Support for updating nested json in dynamoDB HOT 1
- Promise support HOT 4
- Boolean "false", becomes "undefined" HOT 6
- Docs scroll to top HOT 2
- Cannot use region provided in config.json HOT 2
- Executing an average operation on the DB HOT 1
- "OR" support in scan HOT 3
- Looping Scan with async/await question. HOT 3
- Issues due to shrinkwrap.json HOT 3
- Recursive scan example HOT 6
- Update table HOT 2
- Support to pass array of attribute names for "select" operand HOT 2
- Support Dynamo Transactions HOT 6
- BatchInsert not working HOT 2
- transact.insert is undefined on Lambda Layer HOT 2
- Support AWS SDK v3 HOT 2
- Disable Table Schema Table Warning HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dynamodb-oop.