Undefined on query results, but JSON.stringify() works fine

Sorry for all the questions.

I am trying to do what should be a basic query inside my cloud function. However i am getting undefined on the properties when looping through the them.

But strange thing is that if i do JSON.stringify() on my result objects, it shows all the data is there, but if i try and access any of the properties it gives undefined, tried everything i can think of.

Am i missing something really basic here?

// get all offers (not ideal - we need a better query!)
    let allOffersQ = new Moralis.Query("Offers");
    const allOffers = await allOffersQ.find({useMasterKey: true});

    for(let i=0; i<allOffers.length; i++)
        logger.info(JSON.stringify(n)); // works
        logger.info(allOffers[i].objectId) // undefined
        //logger.info(allOffers.get("objectId")) // get isn't a function
        logger.info(allOffers[i]["objectId"]) // undefined

1 Like

did you try: logger.info(allOffers[i]) ?

Hi, i have the same problem, did you solve it?

did you try .id instead of .objectId?

It’s fine I already figured this one out before but happened to forget from the previous time:

Try the following @phinett10


That gets the objectId