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;








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










share|improve this question






























    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










    share|improve this question


























      0












      0








      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










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 26 at 15:10







      jermiah

















      asked Mar 26 at 2:30









      jermiahjermiah

      11 bronze badge




      11 bronze badge






















          1 Answer
          1






          active

          oldest

          votes


















          0














          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.






          share|improve this answer






















            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
            );



            );













            draft saved

            draft discarded


















            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









            0














            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.






            share|improve this answer



























              0














              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.






              share|improve this answer

























                0












                0








                0







                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.






                share|improve this answer













                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 26 at 15:26









                jermiahjermiah

                11 bronze badge




                11 bronze badge


















                    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.



















                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현