[SOLVED] Receiving empty array of results when trying to fetch data from the user table

Question, when using the include, it works perfectly for all the linked tables except for the user table, i am testing it separately :

`const query = new Moralis.Query("ListedItems");`
 `query.include("user.username");` 
`const queryResults = await query.find({userMasterKey:true});`

but the results are empty, i have tried

`query.include("User.username");` 
`query.include("_user.username");`
 `query.include("_User.username");`

but none worked any advice?

did you try also query.include('user'); query.include('user.username')?

yes i did try that and i also tried only

query.include('user');

and also returned empty array

query.select("user") still nothing?

yes also nothing empty results

Ok, Iโ€™ll test it too

1 Like

It looks like this returns me all user data:

Moralis.Cloud.define("test_user_pointer",  async (request) => {
   const query = new Moralis.Query("_Session");
   query.include("user")
   query.select("sessionToken", "user")
   x = await query.find({useMasterKey:true});
   return x;   
});
 const query = new Moralis.Query("ListedItems");
   query.include("user")
   query.select("askingPrice", "user")
   let res = await query.find({useMasterKey:true});
   return {
   	"user": res.user,
    "price" : res.askingPrice,
   };

i used the same syntax and still got nothing, i might be doing something wrongโ€ฆ
this is a log of the results also

What you see for this:

   const query = new Moralis.Query("ListedItems");
   query.include("user")
   query.select("askingPrice", "user")
   let res = await query.find({useMasterKey:true});
   logger.info(JSON.stringify(res));
1 Like

1- i deleted all the rows that were created before linking the user table
2- i ran the JSON.stringify(res) and everything worked smoothly