Tag: 批量

C#mongodb驱动2.0 – 如何在批量操作中进行upsert?

我从1.9迁移到2.2并阅读文档我很惊讶地发现在批量操作期间不可能进行升级,因为操作不允许选项。 bulkOps.Add(new UpdateOneModel(filter, update)); collection.BulkWrite(bulkOps); 应该 options.isUpsert = true; bulkOps.Add(new UpdateOneModel(filter, update, options)); collection.BulkWrite(bulkOps); 这项工作正在进行中,有意或者我遗漏了什么? 谢谢。