Can I use Postgres JSON column types with Loopback?
816 views
Skip to first unread message
Mark L
unread,
Mar 16, 2015, 12:08:50 PM3/16/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to loopb...@googlegroups.com
I am starting a new project with a postgresql backend. I am evaluating loopback as a potential API server. 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? If not, is this a planned change?
thanks,
Mark
jmls
unread,
Mar 17, 2015, 6:53:45 AM3/17/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to loopb...@googlegroups.com
I've asked this before - it would be useful to know ...
Mark L
unread,
Mar 19, 2015, 3:33:10 PM3/19/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to loopb...@googlegroups.com
Yes, it would be useful...
Omid S
unread,
Mar 27, 2015, 6:56:30 PM3/27/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to loopb...@googlegroups.com
I'm also interested in this!
Líus Fontenelle Carneiro
unread,
Mar 28, 2015, 8:13:32 AM3/28/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to loopb...@googlegroups.com
I'm using json and jsonb types with LB without problems. Postgres connector supports json type by serialising it using JSON.stringify when defined on model as a object or array of object. I'm also using with embedsMany relationship.
Best Regards,
Líus
Omid S
unread,
Mar 28, 2015, 8:24:14 AM3/28/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to loopb...@googlegroups.com
Based on the Type mapping tables in http://docs.strongloop.com/display/public/LB/PostgreSQL+connector, JSON is mapped to VARCHAR2 in Postgres. As you said, LB stringifies the objects and then stores them as text. But doing things this way, you would miss the benefits of native JSON column types in Postgres.
Líus Fontenelle Carneiro
unread,
Mar 29, 2015, 7:52:10 AM3/29/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to loopb...@googlegroups.com
Take a look directly on the source. Also, you can use jsonb and take advantage of more features, using the same string-serialization communication. In the end of day, this is the interface postgresql uses to handle json/jsonb types on queries.
Omid S
unread,
Mar 29, 2015, 8:33:31 AM3/29/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message