[SOLVED] Query table export

I created a table in the Moralis mongodb. I’d like to export it. I’m using a Moralis query. However, I only get back object IDs, not the other columns in the table. Please help.

Here’s my code:

  const mytable = Moralis.Object.extend("History");
  const query = new Moralis.Query(mytable);
  const results = await query.find();

  for (let i = 0; i < results.length; i++) {
    const object = results[i];
    console.log(object.get("start")); //Doesn't work
  }

Here’s what the results object looks like:
image

Here’s the same object in the Moralis admin console. Note the extra columns:

You can make it work, you can use .select in the original query and also try with object.attributes

It is possible to do it

I don’t understand. Can you show some code please?

I don’t have the code now, but it is possible to do it. You can also search on google how to do it with parse server.

I searched and couldn’t find anything. Hoping for a bit more support than “google it”

I can give you example later today

an example for a similar case:

    query = new Moralis.Query("WatchedEthAddress");
    query.include("address")
    query.limit(500)
    result = query.find({useMasterKey:true})
    result.then(
      function(value) {
        value.forEach((v) => console.log(v.get('address')));
      },
      function(error) {console.log(error);}
    );     

Thanks. This is the line I was missing:

1 Like