Luzan Baral
Luzan Baral

Reputation: 3698

How to Update Collections in Azure Cosmos DB

I am trying to update collection of User who signed up yesterday into our system. My objective is to find the users who registered yesterday and set isActive to true. I am able to get list of users who registered on specific date but not sure on how to update them

This is the query I am using to select list of user. I am using this from inside Azure > Azure Cosmos DB > Query Explorer

SELECT * FROM UserAccounts u WHERE u.isActive = false AND u.signupDate
>= "2017-12-18" AND u.signupDate <= "2017-12-19"

I am getting list of 26 users who signed up yesterday using this query. I was referring to this doc of MSFT but couldn't find how.

If this cannot be done using Query Explorer, then please mention how can I do this change internally.

Upvotes: 4

Views: 7841

Answers (1)

Matias Quaranta
Matias Quaranta

Reputation: 15603

Query Explorer in the Azure Portal is only to run Queries, not perform Insert/Update operations.

You can use the Data Explorer to run queries and access and edit the filtered results the way you want.

Data Explorer access menu

In the Documents section, you can apply a Filter as a Query (your WHERE clause), then click on the results and edit and Update them.

Filtering in Data Explorer

Just remember to only apply the WHERE clause in the Filter section, in your case, WHERE c.isActive = false AND c.signupDate >= "2017-12-18" AND c.signupDate <= "2017-12-19" should work.

Upvotes: 3

Related Questions