[SOLVED] Unable to query address from database with lowercase restriction

Hey guys,

I’m trying to query data of users connected to my website as follows:

    const {isWeb3Enabled, account, user} = useMoralis() 
    
    const { data: ownerWhoopys, isFetching: fetchingListedWhoopys, fetch } =
    useMoralisQuery("CreatedWhoopys", (query) =>
    query.equalTo("creatorAddress", account).limit(100).ascending("whoopyName"),
    [account] 
    )
    console.log(ownerWhoopys);
    console.log(account)

The query doesn’t work and I believe this is because Moralis Queries the database using lowercase, and the addresses stored in the database are a mix of upper and lower case. Is there any way to fix this?

Thanks!

You could use a match with ignore case

Maybe in a cloud function

Or you could change the address in the database to be lowercase

How to use a match with ignore case?

You can try something like this

query.matches(key, value, ‘i’)

Works!! Thank you! :raised_hands:t2:

1 Like