本文介绍了Couchbase 不能 MutateIn 多个具有空值的 upsert的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Couchbase 文档,我想在一次调用中改变多个属性.如果属性值之一为 null,则 mutate 失败并显示以下消息:

I have a Couchbase document that I want to mutate multiple properties on in one call. If one of the property values is null, the mutate fails with a message of:

KV 错误:{Name="EINVAL", Description="Invalid packet", Attributes="internal,invalid-input"}

Couchbase.IO.ResponseStatus.InvalidArguments

如果我只是尝试将单个属性更改为 null,并且所有属性值都不为 null.变异会成功.

If I just try to mutate a single property with null, and if none of the property values are null. The mutate will be successful.

此外,如果我尝试将多个属性更改为 null,它将失败.

Also if I try to mutate multiple properties to null it will fail.

// This works
var mutatedWorks1 = bucket.MutateIn<dynamic>(doc1.DocId)
    .Upsert("nullProperty", "NotNull")
    .Upsert("name", "MutatedName")
    .Execute();

// This also works
var mutatedWorks2 = bucket.MutateIn<dynamic>(doc1.DocId)
    .Upsert("nullProperty", null)
    .Execute();

// This doesn't work
var mutatedNotWork = bucket.MutateIn<dynamic>(doc1.DocId)
    .Upsert("nullProperty", null)
    .Upsert("name", "MutatedName")
    .Execute();

// This also doesn't work
var mutatedNotWork = bucket.MutateIn<dynamic>(doc1.DocId)
    .Upsert("nullProperty", null)
    .Upsert("name", null)
    .Execute();

Couchbase 客户端是 .Net SDK 2.7.10

Couchbase client is .Net SDK 2.7.10

如果一个或多个属性值为空,我如何改变多个属性?

How can I mutate multiple properties if one or more of the property values are null?

推荐答案

此问题现已修复 (NCBC-2038) 并计划在我们计划于 2019 年 8 月 6 日发布的下一个维护补丁中发布.

This has now been fixed (NCBC-2038) and is scheduled for release in our next maintenance patch which is scheduled for 6th Aug 2019.

谢谢

这篇关于Couchbase 不能 MutateIn 多个具有空值的 upsert的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 01:00