Hi, I need to query to “User” table. The strange thing here is that:
-
If I am not logged in, I retrieve empty array of users from “User” table. Whereas I should have 2 users now in my “User” table.
-
If I am logged in, I retrieve array of my logged-in user only. Whereas I should retrieve the 2 users both from my “User” table.
This is my code, very simple. I just comment out the login/logout line to try the case 1 and 2 above.
import React from "react";
import Moralis from "moralis/dist/moralis.min.js";
import { useEffect } from "react";
export const TryUser = () => {
useEffect(async () => {
// login
//Moralis.User.logIn("[email protected]", "1234");
// logout
Moralis.User.logOut();
const user = new Moralis.Query("User");
const userResults = await user.find();
console.log(userResults);
});
return <div></div>;
};
And this is my “User” table
If I do query like
user.equalTo("username", "user2");
- The result will be empty array if I am logged in as user1.
- Meanwhile, the result is received if I am logged in as user2.