0

I have a dynamo db schema lets say goes like this

const team = new dynamoose.Schema(
  {
   bitbucketDetails: [
      {
        id: {
          type: String,
          required: true,
        },
        repository: {
          type: String,
        },
      
      },
    ],
})

I wanted to search for an item having lets say particular repository "abc". how can i search that?

so far i tried something like team.scan({ bitbucketDetails: { contains:"abc" }}).all().exec() but keep saying ValidationException: One or more parameter values were invalid: ComparisonOperator CONTAINS is not valid for M AttributeValue type.

Please help!!

Nirmesh
  • 305
  • 5
  • 12

1 Answers1

0

You are looking for the value in bitbucketDetails, but you want to look in bitbucketDetails.repository.

karjan
  • 936
  • 1
  • 7
  • 17
  • So are you suggesting team.scan({ bitbucketDetails.repository: { contains:"abc" }}).all().exec(). will work? – Nirmesh Dec 07 '20 at 04:56
  • I'm not that familiar with Dynamoose, so not sure about semantics. But the idea of your search is wrong. You tried to look over keys in bitbucketDetails, which is a map. Something like that might work team.scan({ bitbucketDetails: {repository: { contains:"abc" }}}).all().exec(). But like I said, not sure if that's the way to build dynamoose conditions – karjan Dec 07 '20 at 09:31