简体   繁体   English

无效的 Bson 字段 $set 或 $inc with upsert true 抛出异常

[英]Invalid Bson Field $set or $inc with upsert true throwing exception

{"updateOne":{
    "filter":{"_id":"0"},
    "update":{"$set":{"errorCodeCount":1}},
    "upsert":true
}}

While calling bulkWrite method in java vertx, it's giving the exception java.lang.IllegalArgumentException: Invalid BSON field name $set在 java vertx 中调用 bulkWrite 方法时,它给出了异常java.lang.IllegalArgumentException: Invalid BSON field name $set

Your update field value is not interpreted as a new document.您的更新字段值未被解释为新文档。 I think the easiest way would be to separately define the filter document and the update document.我认为最简单的方法是分别定义过滤文档和更新文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM