Hi Eitan!
Quick question here! I'm trying to query a referenced field from a collection. I couldn't find any reference for this in the documentation. Is this even possible? Thanks!
Note: My query displays results if I don't add the "city" criteria. But when I do, I don't have any results.
Christian
//Get the default value for Rental
$w("#repeaterSales").onItemReady(($item, itemData, index) => {
$item("#equipmentPicture").onClick(() => { openEquipment(itemData._id) })
$item("#equipmentPicture").src = itemData.equipment.mainPicture
$item("#title").text = itemData.title
$item("#defaultPrice").text = itemData.defaultPrice
$item("#city").text = itemData.equipment.city
// $item("#price").text = itemData.price
})
const isActive = wixData.query("sales").eq("isActive", true)
const minPrice = wixData.query("sales").gt("defaultPrice", 2)
const city = wixData.query("sales").eq("equipment.city", "1")
const querySalesResult = await isActive
//.and (city)
.and(minPrice)
.include("equipment")
.descending("_createdDate")
.find();
const myData = querySalesResult.items
$w("#repeaterSales").data = myData;
Hi Christian, Very interesting question. Using dot notation to query in that way would only be relevant if you were using an 'object' data type field in the collection. This is the documentation for querying reference fields is here: https://dev.wix.com/docs/velo/api-reference/wix-data/query-referenced While they don't show it in the example, I think you should be able to narrow down the query in a similar way to a standard query. Let us know! Eitan