0
 var added = await Feature.scan("parentId").eq(baseIds).exec()
        .then(function (add) {
            return add.populate({
               path: 'parentId',
              model: 'Feature'
             })
           })

I have a server already setup working with dynamoose. I want to make a query on basic of a value field and then populate but i am not able to achieve it with the solutions in the dynamoose api docs.Please help here.

ydvsailendar
  • 15
  • 10

1 Answers1

0

According to the Dynamoose documentation:

Dog.scan().exec()
  .then(function(dogs) {
    return Promise.all(dogs.map(function(dog) {
      return dog.populate({
        path: 'parent',
        model: 'Dog'
      });
    }));
  })
  .then(function(dogs) {
    console.log(dogs);
  });

Since scan gives you an array of objects, you have to populate each item individually and wait for all those promises to succeed.

Charlie Fish
  • 18,491
  • 19
  • 86
  • 179