Nodejs: Identity returned by Insert is a nested object. It doens't return id anymore

Did some testing with an integer as primary key and it worked fine. What is the json generated by the insert action?

It should look like:

      {
        "name": "insert1",
        "module": "dbupdater",
        "action": "insert",
        "options": {
          "connection": "db",
          "sql": {
            "type": "insert",
            "values": [
              {
                "table": "test",
                "column": "firstname",
                "type": "text",
                "value": "John"
              },
              {
                "table": "test",
                "column": "lastname",
                "type": "text",
                "value": "Doe"
              }
            ],
            "table": "test",
            "query": "INSERT INTO test\n(firstname, lastname) VALUES ('John', 'Doe')",
            "params": [],
            "returning": "id"
          }
        },
        "meta": [
          {
            "name": "identity",
            "type": "text"
          },
          {
            "name": "affected",
            "type": "number"
          }
        ],
        "output": true
      }

Important is the added "returning": "id".

1 Like