Problems with Sets in Nested Schemas with Dynamoose

32 Views Asked by At

I have a nested Data structure in my DynamoDB Table that looks like this

"filter": {
    "M": {
      "foo": {
        "NS": [
          "2"
        ]
      },
      "bar": {
        "NS": [
          "456"
        ]
      },
      "basz": {
        "NS": [
          "0"
        ]
      },
      "fool": {
        "NS": [
          "2"
        ]
      },
      "version": {
        "SS": [
          "VersionBest"
        ]
      }
    }
  },

and created a Dynamoose Schema like this:

filter: {
        type: Object,
        schema: {
            foo: {
                type: Set,
                schema: [Number],
            },
            bar: {
                type: Set,
                schema: [Number],
            },
            basz: {
                type: Set,
                schema: [Number],
            },
            fool: {
                type: Set,
                schema: [Number],
            },
            version: {
                type: Set,
                schema: [String],
            },
        },
    },

When I perform a scan via the Model i do not get the data from the sets. Instead it is empty like this:

"filter": {
            "foo": {},
            "bar": {},
            "basz": {},
            "fool": {},
            "version": {}
        },

I tried creating an own schema for the Filterattributes and passing it to the filter object but this did not help. When i change araound the schema i got following error: Expected filter.foo to be of type object, instead found type object. How can i make Sets work in a nested schema ?

0

There are 0 best solutions below