objection.js icon indicating copy to clipboard operation
objection.js copied to clipboard

JSON support for mysql and sqlite3

Open elhigu opened this issue 8 years ago • 4 comments

ref() implementation and updating internal attribute of JSON column should be dialect specific and tests be changed to be run with all dialects.

elhigu avatar Jan 06 '17 14:01 elhigu

Any progress with this issue? May I offer help?

Thanks.

danielyogel avatar Jan 26 '18 12:01 danielyogel

@danielyogel help is very much welcome. I'm not going to implement this unless I need this functionality at some point or I get really bored with my life and other projects I'm working on.

elhigu avatar Jan 26 '18 12:01 elhigu

Hi Does this mean that currently for JSON query support I have to use postgresql ? or is it possible to do it with mysql with raw queries ?

SacDin avatar Apr 16 '20 14:04 SacDin

Does this mean that currently for JSON query support I have to use postgresql ? or is it possible to do it with mysql with raw queries ?

It's possible to use raw queries to do this. Here's an example that gets an id and a value "foo" from a MySQL JSON field "object."

Model .query().select(['id', raw("object->'$.foo' AS foo")])

That said, this feature prompted me to look deeper into PostgreSQL, and I came away with the feeling that for my needs (a combination of relational tables and noSQL style data) it was ultimately a better fit than MySQL.

I'm not usually one to shake up my architecture for a piece of software. But I'm looking forward to seeing how this goes.

sokulski avatar Jul 17 '20 15:07 sokulski