Advertisement
zaletniy

MagnetoDB: If item exists

Dec 17th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // insert if item doesn't exist
  2. {
  3.     "item": {
  4.         "Author": {
  5.             "S": "John Doe22"
  6.         },
  7.         "MessageId": {
  8.             "S": "1"
  9.         },
  10.         "Body": {
  11.             "S": "Some vacation issues"
  12.         },
  13.         "DateTime": {
  14.           "N": "20140313164951"
  15.         },
  16.         "DateTime3": {
  17.           "N": "20140313164951"
  18.         }
  19.     },
  20.   "expected":{
  21.         "Author":{
  22.           "exists":false
  23.         }
  24.  
  25.   },
  26.   "return_values":"ALL_OLD"
  27. }
  28.  
  29.  
  30. // table description
  31. {
  32.     "table_name": "email_data",
  33.     "attribute_definitions": [
  34.         {
  35.             "attribute_name": "Author",
  36.             "attribute_type": "S"
  37.         },
  38.         {
  39.             "attribute_name": "Subject",
  40.             "attribute_type": "S"
  41.         },
  42.         {
  43.             "attribute_name": "Body",
  44.             "attribute_type": "S"
  45.         },
  46.         {
  47.             "attribute_name": "DateTime",
  48.             "attribute_type": "N"
  49.         },
  50.         {
  51.             "attribute_name": "MessageId",
  52.             "attribute_type": "S"
  53.         }
  54.     ],
  55.     "key_schema": [
  56.         {
  57.             "attribute_name": "Author",
  58.             "key_type": "HASH"
  59.         },
  60.         {
  61.             "attribute_name": "MessageId",
  62.             "key_type": "RANGE"
  63.         }
  64.     ],
  65.     "local_secondary_indexes": [
  66.         {
  67.             "index_name": "Subject_index",
  68.             "key_schema": [
  69.                 {
  70.                     "attribute_name": "Author",
  71.                     "key_type": "HASH"
  72.                 },
  73.                 {
  74.                     "attribute_name": "Subject",
  75.                     "key_type": "RANGE"
  76.                 }
  77.             ],
  78.             "projection": {
  79.                 "projection_type": "ALL"
  80.             }
  81.         },
  82.         {
  83.             "index_name": "DateTime_index",
  84.             "key_schema": [
  85.                 {
  86.                     "attribute_name": "Author",
  87.                     "key_type": "HASH"
  88.                 },
  89.                 {
  90.                     "attribute_name": "DateTime",
  91.                     "key_type": "RANGE"
  92.                 }
  93.             ],
  94.             "projection": {
  95.                 "projection_type": "ALL"
  96.             }
  97.         }
  98.     ]
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement