How to remove last element in set in dynamo?Remove empty elements from an array in JavascriptHow do I debug Node.js applications?How do I get started with Node.jsHow do I pass command line arguments to a Node.js program?How to decide when to use Node.js?How to exit in Node.jsWhat is the purpose of Node.js module.exports and how do you use it?How can I update NodeJS and NPM to the next versions?How do I update each dependency in package.json to the latest version?dynamo db error Invalid ProjectionExpression: An expression attribute name used in the document path is not defined; attribute name: #P
Machine learning and operations research projects
Why are Hobbits so fond of mushrooms?
Is anyone advocating the promotion of homosexuality in UK schools?
Constructive proof of existence of free algebras for infinitary equational theories
Is Trump personally blocking people on Twitter?
US Civil War story: man hanged from a bridge
Optimization terminology: "Exact" v. "Approximate"
Is there any word for "disobedience to God"?
What is this triple-transistor arrangement called?
Using Newton's shell theorem to accelerate a spaceship
The monorail explodes before I can get on it
How many hours would it take to watch all of Doctor Who?
If a non-friend comes across my Steam Wishlist, how easily can he gift me one of the games?
During copyediting, journal disagrees about spelling of paper's main topic
What explains 9 speed cassettes price differences?
Single word for "refusing to move to next activity unless present one is completed."
Would dual wielding daggers be a viable choice for a covert bodyguard?
What is the job of the acoustic cavities inside the main combustion chamber?
Why didn't Thanos kill all the Dwarves on Nidavellir?
How did the hit man miss?
Should disabled buttons give feedback when clicked?
Keep milk (or milk alternative) for a day without a fridge
Simple interepretation problem regarding Polynomial Hierarchy?
RPI3B+: What are the four components below the HDMI connector called?
How to remove last element in set in dynamo?
Remove empty elements from an array in JavascriptHow do I debug Node.js applications?How do I get started with Node.jsHow do I pass command line arguments to a Node.js program?How to decide when to use Node.js?How to exit in Node.jsWhat is the purpose of Node.js module.exports and how do you use it?How can I update NodeJS and NPM to the next versions?How do I update each dependency in package.json to the latest version?dynamo db error Invalid ProjectionExpression: An expression attribute name used in the document path is not defined; attribute name: #P
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have created a set using dynamoDB document client . I am able to remove items in this set however when i remove to the last element in the set nothing returns until i make a new post. Then all the other data is displayed.
const params =
TableName: 'beta-user-' + process.env.NODE_ENV,
Key:
username: request.username
,
UpdateExpression: "DELETE #features :feature",
ExpressionAttributeNames: "#features" : "features" ,
ExpressionAttributeValues: ":feature": dynamodb.createSet([request.feature]) ,
ReturnValues: "NONE"
;
and im calling it like
const dynamoPromise = dynamodb.update(params).promise();
return await dynamoPromise.then(result => // stuff )
The UpdateExpression
i do not think is wrong
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
I belive the problem is with ExpressionAttributeValues
if i remove dynamodb.createSet
I get many validation errors.
When i make a get request to app i get
"message": [
"username": "x",
"feature": [
"blah",
"test"
]
,
"username": "z",
"feature": [
"blah"
]
,
I make a delete request and remove the feature test
from username x
. This works and returns the same response minus the test
feature. I make another delete request to remove blah
. Blah is removed however when I make a get
request I recieve:
"message":
The other data is returned when i make a new post to that specific user.
EDIT:
I think the issue might be due to dynamo not liking an empty set
node.js amazon-dynamodb serverless-framework
add a comment |
I have created a set using dynamoDB document client . I am able to remove items in this set however when i remove to the last element in the set nothing returns until i make a new post. Then all the other data is displayed.
const params =
TableName: 'beta-user-' + process.env.NODE_ENV,
Key:
username: request.username
,
UpdateExpression: "DELETE #features :feature",
ExpressionAttributeNames: "#features" : "features" ,
ExpressionAttributeValues: ":feature": dynamodb.createSet([request.feature]) ,
ReturnValues: "NONE"
;
and im calling it like
const dynamoPromise = dynamodb.update(params).promise();
return await dynamoPromise.then(result => // stuff )
The UpdateExpression
i do not think is wrong
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
I belive the problem is with ExpressionAttributeValues
if i remove dynamodb.createSet
I get many validation errors.
When i make a get request to app i get
"message": [
"username": "x",
"feature": [
"blah",
"test"
]
,
"username": "z",
"feature": [
"blah"
]
,
I make a delete request and remove the feature test
from username x
. This works and returns the same response minus the test
feature. I make another delete request to remove blah
. Blah is removed however when I make a get
request I recieve:
"message":
The other data is returned when i make a new post to that specific user.
EDIT:
I think the issue might be due to dynamo not liking an empty set
node.js amazon-dynamodb serverless-framework
add a comment |
I have created a set using dynamoDB document client . I am able to remove items in this set however when i remove to the last element in the set nothing returns until i make a new post. Then all the other data is displayed.
const params =
TableName: 'beta-user-' + process.env.NODE_ENV,
Key:
username: request.username
,
UpdateExpression: "DELETE #features :feature",
ExpressionAttributeNames: "#features" : "features" ,
ExpressionAttributeValues: ":feature": dynamodb.createSet([request.feature]) ,
ReturnValues: "NONE"
;
and im calling it like
const dynamoPromise = dynamodb.update(params).promise();
return await dynamoPromise.then(result => // stuff )
The UpdateExpression
i do not think is wrong
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
I belive the problem is with ExpressionAttributeValues
if i remove dynamodb.createSet
I get many validation errors.
When i make a get request to app i get
"message": [
"username": "x",
"feature": [
"blah",
"test"
]
,
"username": "z",
"feature": [
"blah"
]
,
I make a delete request and remove the feature test
from username x
. This works and returns the same response minus the test
feature. I make another delete request to remove blah
. Blah is removed however when I make a get
request I recieve:
"message":
The other data is returned when i make a new post to that specific user.
EDIT:
I think the issue might be due to dynamo not liking an empty set
node.js amazon-dynamodb serverless-framework
I have created a set using dynamoDB document client . I am able to remove items in this set however when i remove to the last element in the set nothing returns until i make a new post. Then all the other data is displayed.
const params =
TableName: 'beta-user-' + process.env.NODE_ENV,
Key:
username: request.username
,
UpdateExpression: "DELETE #features :feature",
ExpressionAttributeNames: "#features" : "features" ,
ExpressionAttributeValues: ":feature": dynamodb.createSet([request.feature]) ,
ReturnValues: "NONE"
;
and im calling it like
const dynamoPromise = dynamodb.update(params).promise();
return await dynamoPromise.then(result => // stuff )
The UpdateExpression
i do not think is wrong
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.DELETE
I belive the problem is with ExpressionAttributeValues
if i remove dynamodb.createSet
I get many validation errors.
When i make a get request to app i get
"message": [
"username": "x",
"feature": [
"blah",
"test"
]
,
"username": "z",
"feature": [
"blah"
]
,
I make a delete request and remove the feature test
from username x
. This works and returns the same response minus the test
feature. I make another delete request to remove blah
. Blah is removed however when I make a get
request I recieve:
"message":
The other data is returned when i make a new post to that specific user.
EDIT:
I think the issue might be due to dynamo not liking an empty set
node.js amazon-dynamodb serverless-framework
node.js amazon-dynamodb serverless-framework
edited Mar 26 at 15:10
jermiah
asked Mar 26 at 2:30
jermiahjermiah
11 bronze badge
11 bronze badge
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The issue was with my return statement in my get request. I assumed that once features were deleted the record would be deleted. I was trying to return features on an object that had no features, therefore, it was erroring out and not returning anything.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55349017%2fhow-to-remove-last-element-in-set-in-dynamo%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The issue was with my return statement in my get request. I assumed that once features were deleted the record would be deleted. I was trying to return features on an object that had no features, therefore, it was erroring out and not returning anything.
add a comment |
The issue was with my return statement in my get request. I assumed that once features were deleted the record would be deleted. I was trying to return features on an object that had no features, therefore, it was erroring out and not returning anything.
add a comment |
The issue was with my return statement in my get request. I assumed that once features were deleted the record would be deleted. I was trying to return features on an object that had no features, therefore, it was erroring out and not returning anything.
The issue was with my return statement in my get request. I assumed that once features were deleted the record would be deleted. I was trying to return features on an object that had no features, therefore, it was erroring out and not returning anything.
answered Mar 26 at 15:26
jermiahjermiah
11 bronze badge
11 bronze badge
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55349017%2fhow-to-remove-last-element-in-set-in-dynamo%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown