Wie legen Sie json in dynamodb

Hier ist mein code.

Ich möchte einfügen asset_data json in asset_data Spalte.
ich bin mit aws sdk.
Es sagt aws-sdk bietet nun Unterstützung für json.
http://aws.amazon.com/releasenotes/SDK/JavaScript/1691866671551861

var asset_data = {
    "name": "name" + i,
    "contentUrl": "http://www.hdwallpapersimages.com/nature-beauty-desktop-images/94892/",
    "size": 300,
    "headline": "headline",
    "description": "assetUrl reference for the creator",
    "encodingFormat": 'jpeg'
  };

  var params = {
    TableName: 'xyz',
    Item: { //a map of attribute name to AttributeValue
      "asset_id": {S: "asset" + i},
      "hit_id": {S: "0"},
      "created_date": {"S": Date.now().toString()},
      "status": {N: "0"},
      "operation": {S: "image_tagging"},
      "asset_data": {L: asset_data},
      "source": {S: "DAM"},
      "completed_date": {S: Date.now().toString()},
      "response_data": {S: "taged value"}
      //more attributes...
    },

    ReturnValues: 'NONE', //optional (NONE | ALL_OLD)
    ReturnConsumedCapacity: 'NONE', //optional (NONE | TOTAL | INDEXES)
    ReturnItemCollectionMetrics: 'NONE' //optional (NONE | SIZE)
  };

  db.putItem(params, function (err, data) {
    if (err) console.log(err); //an error occurred
    else console.log("inserted..."); //successful response
  });
InformationsquelleAutor mks | 2015-10-05
Schreibe einen Kommentar