[SOLVED] Query data contains only pointers but not the fields of these classes

I am storing an Object into a custom class where values of these objects are other Moralis Objects. Now in my front-end when I query this data, its all of type “Pointer” without any attributes or data. How can I retrieve these?

This is how I store the Object

  dexTrade.set("dex", parsedDexTrade.exchange);
    dexTrade.set("transaction_hash", parsedDexTrade.transaction_hash);
    dexTrade.set("token0", parsedDexTrade.token0); //Moralis Object
    dexTrade.set("token0_value", parsedDexTrade.token0_value);
    dexTrade.set("token0_usd_value", parsedDexTrade.token0_usd_value);
    dexTrade.set("token1", parsedDexTrade.token1); //Moralis Object
    dexTrade.set("token1_value", parsedDexTrade.token1_value);
    dexTrade.set("token1_usd_value", parsedDexTrade.token1_usd_value);
    dexTrade.set("token0_ticker", parsedDexTrade.token0_ticker); //Moralis Object
    dexTrade.set("token1_ticker", parsedDexTrade.token1_ticker); //Moralis Object
    dexTrade.set("isStableCoinTrade", parsedDexTrade.isStableCoinTrade);
    dexTrade.set("side", parsedDexTrade.side);

    return dexTrade.save(null, { useMasterKey: true });

now when I query.find() on this generated Class, all the commented fields are without attributes of type Pointer. But I want them to be stored so I can get all their data when I query the parent.

usually you need to use a combination of .select .include to see the data from pointers

I tried this but didnt make any difference

    const query = new Moralis.Query("DexTrade");

did you try with query.select too?

1 Like

I figured it out. I was doing it somewhat correctly, only the value inside the “include” has to be the name ofthe column within that Collection.

query.include(“TokenMetaData”) has to be query.include(“tokenmetadata”) , case sensitive

1 Like