Giving reference of an object in query


I have structure of my entity like this
Class A{
String a;
String b;
boolean flag;

Class A{
Class b;
Class c;
boolean flag;
To give a bit of background, the attributes class B and class C were previously two enums which were being stored with String datatype. But now, the data model is modified and String datatype has been changed to object references Class B and Class C.
I have to write a migration script for the existing data present in db to remove the String datatype and make them point to other object class B, class C.
Can you help.


N1QL works on JSON, the class more of SDKs.
If you are looking JSON field of string convert to OBJECT you can try the following example.

INSERT INTO default VALUES ("k01", { "a": "abc", "b":"xyz","flag":true});
UPDATE default SET a = {a}, b = {b};
SELECT * FROM default;
                "a": {
                    "a": "abc"
                "b": {
                    "b": "xyz"
                "flag": true

If you don’t want UPDATE but want the result to be in transformed form you can try this

SELECT flag, {a} AS a , {b} AS b 
FROM default;