Is there a way to concatenate strings in Cosmos DB Java SDK?

Xu, Kyson K 156 Reputation points
2024-02-27T02:15:38.32+00:00

Hi, Is there a way to concatenate strings in Cosmos DB Java SDK? For example, there is a field value of string1, I want to update it to string1, string2, what should I do? I don't want to replace string1 with the whole string of string1, string2, but append it after string1 Thank you for your help.

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,901 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sreeju Nair 12,666 Reputation points
    2024-02-27T09:06:07.46+00:00

    There is a Concat function in the Cosmos DB string functions, where it can take n number of string parameters and return the concatenated string as the result. You can use this function to achieve the desired result you are looking for.

    Refer: https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/concat

    https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/quickstart-java?pivots=devcontainer-codespace#query-items


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.