I needed to find Generic Objects based on attribute values.
vmdb_production=# \d generic_objects;
Table "public.generic_objects"
Column | Type | Modifiers
------------------------------+-----------------------------+--------------------------------------------------------------
id | bigint | not null default nextval('generic_objects_id_seq'::regclass)
name | character varying |
uid | character varying |
generic_object_definition_id | bigint |
created_at | timestamp without time zone | not null
updated_at | timestamp without time zone | not null
properties | jsonb | default '{}'::jsonb
Indexes:
"generic_objects_pkey" PRIMARY KEY, btree (id)
So the name of the column is properties
and its type is JSON. To find all objects with status == 'in-use'
I ended up with the following code based on this howto:
$evm.vmdb(:generic_object).where("properties ->> 'status' = 'in-use'")
If the actual value is in a variable:
value = 'in-use'
$evm.vmdb(:generic_object).where("properties ->> 'status' = '" + value + "'")
HTH