Trying to update a document if it exists, otherwise create a document with the same data. I need to do this using an Index
rather than a direct Ref
as well.
Using this to update in cases where I know for certain it already exists. But in this case, since it cannot be know for sure if the Ref
exists, it throws an error. Tried checking if the Ref
exists, but that doesn't work because the Get
fails.
q.Update(
q.Select(["ref"], q.Get(q.Match(q.Index("fromUUID"), request.UUID))),
{
data: request
}
)
Any help would be greatly appreciated. Thanks.