Hello!
I am extremely new to couchbase and I am trying to understand if it is possible to upsert a document and adding values to an array if it exists.
In mongo, the command is $push
[here] ($push — MongoDB Manual) are the docs on the operation.
I’ll share an example. Given this dataset:
{
'key': 'test1',
'test': ['test1', 'test2']
}
I want to add this dataset:
{
'key': 'test1',
'test': ['test3', 'test4']
}
{
'key': 'test2',
'test': ['test1', 'test2']
}
So that the final result will look like this:
{
'key': 'test1',
'test': ['test1', 'test2', 'test3', 'test4']
}
{
'key': 'test2',
'test': ['test1', 'test2']
}