I have a simple table in CockroachDB v2.0-beta:
CREATE TABLE account (
id UUID NOT NULL DEFAULT uuid_v4()::UUID,
acct JSON NULL,
CONSTRAINT "primary" PRIMARY KEY (id ASC),
INVERTED INDEX account_acct_idx (acct),
FAMILY "primary" (id, acct)
)
I can run a select query to find specific property under acct->properties like this:
select acct->>'id' from account where acct @> '{"properties": {"foo": "bar"}}';
Is there a way to select subset of the Json blob such as nested property? Something like this would be helpful:
select acct->>'id', acct->>'properties:description' from account
where acct @> '{"properties": {"foo": "bar"}}';
Thanks in advance for any hints!
Cheers, ~g