Query EthNFTOwners find [SOLVED]

const query = new Moralis.Query("EthNFTOwner");
  //query.equalTo("symbol", "ZNFT");
  query.containedIn("owner_of", request.user.attributes.accounts);
return await query.find();

learning the cloud function stuff. this part was returning thing sunday morning as i rememeber, now it give me an empty []

return request.user.attributes.accounts;

sends back some info

You can try:
return await query.find({useMasterKey: true});

still geting

[]
    length: 0
    [[Prototype]]: Array(0)

but looking at return query.containedIn("owner_of", request.user.attributes.accounts); we see

{className: "EthNFTOwner", _where: {…}, _include: Array(0), _exclude: Array(0), _count: false, …}
className: "EthNFTOwner"
_count: false
_exclude: []
_extraOptions: {}
_include: []
_includeReadPreference: null
_limit: -1
_localDatastorePinName: null
_queriesLocalDatastore: false
_readPreference: null
_skip: 0
_subqueryReadPreference: null
_where:
    owner_of:
        $in: ["0x3e390615ba4a126d5c362eda56796d29c770ad97"]
        [[Prototype]]: Object

What you pasted there looks like some query details.
What it happens if you do something like:

const query = new Moralis.Query("EthNFTOwner");
  //query.equalTo("symbol", "ZNFT");
  //query.containedIn("owner_of", request.user.attributes.accounts);
return await query.find({useMasterKey:true});
1 Like

length: 0

Moralis.Cloud.define("getUserItems", async (request) => {
	const query = new Moralis.Query("EthNFTOwner");
  //query.equalTo("symbol", "ZNFT");
  //query.containedIn("owner_of", request.user.attributes.accounts);
	return await query.find({useMasterKey:true});
});

The standard table name is EthNFTOwners not EthNFTOwner. Are you sure you are trying to query the correct table?

1 Like

image

i was missing the s, just found it, thanks!

2 Likes