I am trying to do a query of my products but I want to filter out all the products that start with the same name as the current product. Pretty much I need a does not startsWith function or take all the false values of a startsWith. I have attached my code below. This code works perfectly fine without the line I have identified below
async function relatedProductsByPrice(product) {
// Get the current product’s ID.
let productId = product._id;
let productTitle = product.name;
let productSplit = productTitle.split( ’ ’ ).slice( 0 , 1 );
productTitle = productSplit[ 0 ];
let id = await wixData.query( ‘Stores/Products’ )
.include( “collections” )
.eq( ‘_id’ , productId)
.limit( 1 )
.find();
let relatedByPrice= await wixData.query( ‘Stores/Products’ )
.include( “collections” )
.hasSome( “collections” , id.items[ 0 ].collections[ 0 ]._id)
.between( ‘price’ , product.price * 0.8 , product.price * 1.2 )
.!startsWith( “name” , productTitle) // here is the issue
.ne( ‘_id’ , productId)
.find();
return relatedByPrice.items;