Query DynamoDB with Two Matching Fileds

0 votes

I am new into DynamoDB. I am trying to query a collection with two matching fields. I have written a code in MongoDB, I am trying to migrate to DocumentDB. I am facing an issue.

MongoDB Code


getUser= async(req,res)=>{ let user = await user.findOne({phone:123456789, otp:2345}); }



DynamoDB Code

getUser= async(req,res)=>{ const params = { KeyConditionExpression: 'phone = :phone and #otp = :otp', ExpressionAttributeValues: { ':phone': 919600923917, ":otp":2387 }, TableName: "users", }; const user= await documentClient.query(params).promise(); }

Issue: Invalid KeyConditionExpression: An expression attribute name used in the document path is not defined; attribute name: #otp


 

Apr 19 in AWS by Rahul
• 9,680 points
69 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In AWS

0 votes
1 answer

Chalice: Unable to connect with DynamoDB through pynamodb

You have to add "autogen_policy":false, to config.json and ...READ MORE

answered Sep 10, 2018 in AWS by Priyaj
• 58,100 points
1,331 views
+1 vote
1 answer

Do i need to use Amazon EC2 with DynamoDB?

You can use Amazon DynamoDB without restrictions ...READ MORE

answered Oct 11, 2018 in AWS by Archana
• 4,170 points
1,596 views
+1 vote
1 answer

Accessing query parameter in Lambda with Python

Have you gone through the mapping template ...READ MORE

answered Dec 5, 2018 in AWS by bugseeker
41,763 views
0 votes
1 answer

What kind of query is supported by DynamoDB?

DynamoDB provides a huge range of query ...READ MORE

answered Feb 14, 2019 in AWS by Esha Gupta
235 views
0 votes
1 answer

Update and query on data using DynamoDB

Once the database is created using DynamoDB ...READ MORE

answered Feb 14, 2019 in AWS by Esha Gupta
928 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP