tywalch/electrodb

The where clause improperly handles the state of nested properties

tywalch opened this issue · 0 comments

Describe the bug
The where clause improperly handles the state of nested properties

ElectroDB Version
Specify the version of ElectroDB you are using
(e.g. 2.2.4)

ElectroDB Playground Link
https://electrodb.fun/?#code/PQKgBAsg9gJgpgGzARwK5wE4Es4GcA0YuccYGeqCALgUQBYCG5YA7llXWAGbZwB2MXGBDAAUKKwBbAA5QMVMAG8wAUT5V2AT0IBlTADcsAY1IBfbhiiSwAIkRwjVSzABGNgNzijUPrgVUGFwRSAF5bTShUDAB9AKC4aL4GSTgPcVAwABUGXABrITUNKk1hMW9ffxz8sDC+OBZVdS0AClEwJTb2sElYRAAuDq6u-iLNAZsAvNwbfE6h-UxcLB9xgEYZua7iDEMTccnchmlpG03TWaGGKicsF1QqPAHFTfaH5KeXruLpOHG-bD4AHMNkMhuQ0FhyDABk50J9zp8Dh9QV9ND8-jcgSCUWQ4BCoTCMHCUQiUdJLAArBxUZE476-Wz-LBYi448GoSFwaFgWFweGsoZwAAeyWkwVpKPpAwA5JIjtKBaDyVAfvIcLgJTieFZNTieWiGdK+KhJC5MArPkNSXqeVBdXSDTLjabzYqSW6utarWdFcz4ELHoMlZTqRqg2TcvahlwcAhuTZpLlsXrvDIoEsHgMANoTODJGwAXUtYC9oLyUa6McQ8byyZxwGAYCM5CupFTsgzpFycE0Qi4cjA0iYGgYSFwcgU3ZKaEw6uL7Xb6fYDJzyqpjhmtgOheLpnhZ061uUcWCJdEAEpPF4fH4eXnrGEbJJNLF72lyre4LIjJwwgARVsADo+CgFhmkvcQDlwQCZwwTROkAtdQ2aRQ3kkUxzwQlg6EwOBmhQsBhVFcUlAsKxCCoKASxLQhlGoOBCEBB5CBAqgVCFLA-CEDCagAPnDXEqCiPgwAAAwAEkUejmm1SRCC-KAf3PcwAEEADk-zAZpJKYvDKPk786GUsAAHkACUwEk1j2M4mhmko5Tz1Ew9MPaQDASgcCrygmD0DghCkMcXAULQjCsJw8h8KuJxaLAejGOYsBrI4riS3PPiBPIISMBEiSpIeZpoowQCiJkYJANkgzFKM1SNK0nSCqKkqRTKuBAP0wjDOM8zLMUZLbOCprSrFNqHIw0TPHaMK3I8rygA

Entity/Service Definitions
Include your entity model (or a model that sufficiently recreates your issue) to help troubleshoot.

const tasks = new Entity(
  {
    model: {
      entity: "tasks",
      version: "1",
      service: "taskapp"
    },
    attributes: {
      team: {
        type: "string",
        required: true
      },
      task: {
        type: "string",
        required: true
      },
      project: {
        type: "string",
        required: true
      },
      example: {
        type: 'map',
        properties: {
          from: {
            type: 'number',
          },
          to: {
            type: 'number',
          },
        },
      }
    },
    indexes: {
      projects: {
        pk: {
          field: "pk",
          composite: ["team"]
        },
        sk: {
          field: "sk",
          // create composite keys for partial sort key queries
          composite: ["project", "task"]
        }
      }
    }
  }
);

Expected behavior

Received:
"#example.#from <= :from0 AND (#example.#from.#to >= :to0 OR attribute_not_exists(#example.#from.#to))"

Expected:
"#example.#from <= :from0 AND (#example.#to >= :to0 OR attribute_not_exists(#example.#to))"