Questions tagged [documentclient]

The document client simplifies working with items in Amazon DynamoDB by abstracting away the notion of attribute values

The document client simplifies working with items in Amazon DynamoDB by abstracting away the notion of attribute values

45 questions
11
votes
2 answers

DynamoDB | BatchGet | Get results in same order as provided Keys

I'm using AWS DynamoDB to store users. Consider the following code: let params = { RequestItems: { 'users': { Keys: [ {id: '1111'}, {id: '2222'}, {id: '3333'}, {id: '4444'}, ] } } …
Vingtoft
  • 13,368
  • 23
  • 86
  • 135
7
votes
2 answers

How to mock DocumentClient CreateDocumentQuery with filters for DocumentDb unit testing?

I am writing unit tests for below piece of code which is using Document client CreateDocumentQuery method with where(filter) conditions. var documentQuery =…
user7784348
  • 265
  • 2
  • 11
6
votes
1 answer

Retrieving a StringSet value using DynamoDB.DocumentClient in Node

The DynamoDB.DocumentClient automatically marshals & unmarshals values between JavaScript types DynamoDB's more descriptive AttributeMap type. However, when working with an Item that has a StringSet attribute, it does not seem to do the conversion…
6
votes
1 answer

DynamoDB update fails when nested path not exists

My table structure is below where time is the unique key and that "01" was the id of the count, the item of a month will create right after any id get the count result of that month. { "details": { "01": { "a": { "count": [10,…
3
votes
2 answers

Why "documentClient.put" is doing UPDATE instead of INSERT in DynamoDB?

I have a simple logic where I want to INSERT record in the table using AWS.DynamoDB.DocumentClient. Below is code which I am using. Here, I am noticing that .put is updating the record and not sure why. While checking the logs in CW, I am not seeing…
2
votes
0 answers

multiple dynamodb document clients

I tend to organize my API's src code into multiple directories and sub-files based on logical groupings, when it comes to database operations these end up split up into logical directories too FWIW these are nodejs lambdas, but I think this question…
Schalton
  • 2,867
  • 2
  • 32
  • 44
2
votes
0 answers

How to generate a reliable `hasMoreResults` value for pagination in DynamoDB queries

I am trying to perform pagination on a simple DynamoDB table for queries by date range, and had hoped to coerce the LastEvaluatedKey into a "hasMoreResults" boolean value for my front end to consume, but now see that a non-empty LastEvaluatedKey can…
2
votes
0 answers

DynamoDB Query ISO date

I'm new to Dynamo and have been trying to query the DB for a range. I'm doing a query for an ISO date string in my Lambda like this: const start = event['queryStringParameters']['startDate']; const end =…
2
votes
1 answer

stubbing AWS Dynamodb documentClient for integration test

im having some issues stubbing this dependency. I know there ir a aws-sdk-mock modules but mi goal its to stub it with sinon and chai. Here is mi code, Test code const chai = require('chai'); const sinon = require('sinon'); const chaiHttp =…
2
votes
1 answer

DynamoDB,how to query with BEGINS_WITH

i'm using DocumentClient for query. and using serverless framework with DynamoDb. i'm trying to query with BEGINS_WITH without providing any primary key. here is how my data looks like: [ { id: 1, some_string: "77281829121" }, { …
2
votes
1 answer

describe-table method using DocumentClient

How to do this request using DocumentClient? aws dynamodb describe-table --table-name MusicCollection
Dmitry Grinko
  • 13,806
  • 14
  • 62
  • 86
2
votes
1 answer

Empty data object when deleting item from dynamodb

According to the docs I should get a data structure with the item as it was prior to the deletion (in case there was no error) I do check there was no error but I get an empty object for data: docClient.delete(params, (err, data) => { if…
SagiLow
  • 5,721
  • 9
  • 60
  • 115
1
vote
0 answers

Getting error - TypeError: Cannot read properties of undefined (reading 'isSinonProxy')

I'm trying to mock DocumentClient using aws-sdk-client-mock. import { mockClient } from 'aws-sdk-client-mock'; import { DocumentClient } from 'aws-sdk/clients/dynamodb'; const mockDocClient = mockClient(DocumentClient); I'm getting the error…
1
vote
1 answer

DyamoDB put item with ConditionExpression instead of key

Since email is not the primary key, I need to check the uniqueness of a record based on the email field. It does not work. The user gets saved. Does DynamoDB not allow conditionExpression on another field instead of a key? const params = { …
Ben Jonson
  • 565
  • 7
  • 22
1
vote
1 answer

Azure Cosmos DB: Unique index constraint violation using UpsertDocumentAsync

I have defined a UniqueKey policy in my Azure Cosmos DB Container, for field UniqueName The below function is being called on a timer. I'm attempting to Upsert documents in Azure Cosmos DB using Azure Functions bindings, like so: public async Task…
mkcoding
  • 113
  • 3
  • 15
1
2 3