[SOLVED] Cannot get the "Data Browser" data and other objects from Dashboard

Hello, I’m trying to get the data of the Data Browser from the Dashboard using cloud functions. I mean i.e: “Role, Session, User, …” all of them.
Capture

I query for the object and then run the cloud function in the code.

Moralis.Cloud.define("getData", async (request) => {

  //not sure if "DataBrowser" is correct, also tried "browser"
  //but no difference
  const query = new Moralis.Query("DataBrowser"); 
  const results = await query.find();
  return results;
});
getDataBrowser = async () => {
  const data = await Moralis.Cloud.run("getData");
  console.log(data);
}

getDataBrowser();

When I do that I get this array:
Capture

If I put const query = new Moralis.Query("User"); instead, I also get the same result, but when I put Query("Monster"); the created object “Monster”, it console.logs all of the created “Monsters”.

Please help, couldn’t find anything in the documentation or youtube to query the Data Browser using cloud functions.

Hi,
I think that you need to use a syntax like this: await query.find({useMasterKey:true})
but you have to specify one table at a time, like User, Monster
For User class it doesn’t work without {useMasterKey:true} because there is an ACL so that only current user can see its data.

1 Like

Hi @cryptokid,
Ok I understand, makes sense!
I specified “_EthAddress” and I got all the addresses using {useMasterKey: true}. Same with “User” I get all the users.

Thank you for the help! :smiley:

1 Like