I will be grateful if someone can explain to me why query.get() returns undefined and when using JSON.stringify it prints the object in string format.
Moralis.Cloud.define(âtestGetâ, async (request) => {
const logger = Moralis.Cloud.getLogger();
const query = new Moralis.Query(âPolygonTransactionsâ);
const result = await query.get(â6IkfcdBnAdtUgkq5SVVMHrQrâ);
logger.info("--------------------------------------------------");
logger.info(result); // print undefined
logger.info(JSON.stringify(result)); // print object in string format
logger.info("--------------------------------------------------");
return result;
});
LOG
- 2022-04-20T12:25:40.947Z - --------------------------------------------------
- 2022-04-20T12:25:40.946Z - {âblock_timestampâ:{"__type":âDateâ,âisoâ:â2022-04-19T21:20:19.000Zâ},âhashâ:â0xcdcc4a061902d860599ad63e65390789e86318a181022697ca092eb268c7aa9fâ,ânonceâ:189,âblock_hashâ:â0x251ca5b66475390e8c26ed211c1954536c01fefcf44aaba572703e4598bd0491â,âblock_numberâ:26003271,âtransaction_indexâ:6,âfrom_addressâ:â0xe35a73646e8a5997feb40a85c787a6e1bad15191â,âto_addressâ:â0x2f6b8030be7b58fffd082656850aa2189e481f29â,âvalueâ:â10000000000000000â,âgas_priceâ:2500000010,âreceipt_statusâ:1,âgasâ:32436,âinputâ:â0x7b226f726465725f6964223a22485845576e73337831723559383746493538624e784e3637227dâ,âconfirmedâ:true,âorder_idâ:âHXEWns3x1r5Y87FI58bNxN67â,âcreatedAtâ:â2022-04-19T21:20:20.363Zâ,âupdatedAtâ:â2022-04-19T21:28:44.818Zâ,âreceipt_contract_addressâ:null,âreceipt_cumulative_gas_usedâ:2231461,âreceipt_gas_usedâ:21624,âreceipt_rootâ:null,âtransfer_indexâ:[26003271,6],âobjectIdâ:â6IkfcdBnAdtUgkq5SVVMHrQrâ}
- 2022-04-20T12:25:40.945Z - undefined
- 2022-04-20T12:25:40.942Z - --------------------------------------------------