I have the following JSON Store on Azure Cosmos DB.
{ "id": "4", "total": 10.46, "tax": 0.55, "soldItems": [ { "item": "CHEESE NIPS 004400001300 F 1.97 D", "price": 1.97 }, { "item": "ROOT BEER 10.46", "price": 10.46 } ] }
and I am getting no results from this query:
SELECT * from c where CONTAINS(c.soldItems.item, "BEER")
What would be the correct syntax to check for a string in an JSON object value?
NET, Node. js (JavaScript), Java and Python.
In the Azure Cosmos DB blade, locate and select the Data Explorer link on the left side of the blade. In the Data Explorer section, expand the NutritionDatabase database node and then expand the FoodCollection container node. Within the FoodCollection node, select the Items link. View the items within the container.
In the Azure portal, navigate to and select the function app you created previously. Select Functions, and then select the HttpTrigger function. Select Integration and + Add output. Name of the binding type to select to create the output binding to Azure Cosmos DB.
Azure Cosmos DB items Depending on which API you use, data can represent either an item in a container, a document in a collection, a row in a table, or a node or edge in a graph. The following table shows the mapping of API-specific entities to an Azure Cosmos item: Cosmos entity. SQL API. Cassandra API.
Try this:
SELECT VALUE c FROM c JOIN s in c.soldItems WHERE CONTAINS(s.item, "BEER")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With