简体   繁体   English

Dynamodb:无法访问嵌套对象和对象数组

[英]Dynamodb: unable to access nested objects and array of objects

I am new to DynamoDb. 我是DynamoDb的新手。 I am trying to access an object inside the array: 我试图访问数组内的对象:

Created a new item in a table- 在表格中创建了一个新项目-

survey.create({
      survey_name: 'Cycle',
      description: 'Describe me',
      test:[{
        title:'hello1'
      },{
        title:'hello2'
      }]
      }, function (err, survey) {
         if(err){
          console.log(err)
        }else{
          console.log('created', survey.get('survey_name'));
        }
      });

I am not to able to fetch "test[n].title", getting 0 results. 我无法获取“ test [n] .title”,得到0个结果。

survey.query('Cycle')
     .filter('test.title').equals('hello2') //Tried it with test[0].title also
     .exec((err,data)=>{
         if(err){
              console.log(err);
            }
            else{
              console.log(data);
            }
          });

Also, I want to retrieve a part(json) of the item of a table ie. 另外,我想检索表的项目的一部分(json)即。 'test' if its possible 如果可能的话“测试”

Querying DynamoDB using filters requires the key you are filtering on to be the top level key. 使用过滤器查询DynamoDB时,需要将要过滤的键作为top level键。 You cannot filter using a nested object key. 您不能使用嵌套对象键进行过滤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM