Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use postgres JSON column types with Strongloop Loopback?

I am starting a new loopback project with a postgresql backend. I know that I will need to embed JSON objects into records and plan to use the native JSON and JSONB column types available in postgres. I noticed in the online docs that there is no reference to these 2 column types (here: http://docs.strongloop.com/display/public/LB/PostgreSQL+connector).

Is it possible to create to use the column types? if so, how would I do that?

thanks, Mark

like image 776
Mark Lummus Avatar asked May 23 '26 15:05

Mark Lummus


1 Answers

I'm curious and haven't tried this. Have you tried using an Object type with the json postgres data type?

"properties": {
  "dataProp": {
    "type": "Object",
    "required": false,
    "precision": null,
    "scale": null,
    "postgresql": {
      "columnName": "dataProp",
      "dataType": "json"
    }
  }
}

It seems to be supported here: https://github.com/strongloop/loopback-connector-postgresql/blob/79d4fa03bb0922301a22e5d2a85444eadd621ab0/lib/postgresql.js#L480

like image 117
Bryan Clark Avatar answered May 25 '26 08:05

Bryan Clark