I am creating a sample nft market place.
here I hv a table for the collections called (FujiCollections).
I created the collections using.
const Collection = Moralis.Object.extend(“FujiCollections”);
const collectionItem = new Collection({name:‘name’,displayImage:‘displayImage’,symbol:‘symbol’,description:‘description’,urlPath:‘sample-url-path’,contractAddress:‘contractAddress’,account:’’});
collectionItem.save();
then I need to query the table FujiCollections from urlPath, for that I used,
const query = new Moralis.Query(Collection);
query.equalTo(“urlPath”, “sample-url-path”);
const collectionResult = await query.first();
console.log(collectionResult);
this is working without a issue.
my concern is that when there are many entries in the FujiCollections table, this type of query will get slow.To get the result fast I hope to use the urlPath as a secondary index. So I can query faster.
what I try to achieve some think like above,When a user try to add a “short url” , in my case urlPath,
I need to check the db quickly and find out a similar entry exits in the db.