gpt4 book ai didi

c# - 如何修改写关注级别?

转载 作者:可可西里 更新时间:2023-11-01 10:42:24 24 4
gpt4 key购买 nike

我有一个包含 100,000,000 个文档的集合,我每分钟都在执行更新。像这样:

var writeOptions = new BulkWriteOptions { IsOrdered = false };

// Applying several operations within the one request.
operationList.Add(new UpdateOneModel<JobInfoRecord>(Builders<JobInfoRecord>.Filter.Eq("_id", document.JobId),
Builders<JobInfoRecord>.Update.Set("JobInfo", newInfo)));

await jobInfoDocuments.BulkWriteAsync(operationList, writeOptions);

如何将写入关注级别从 1(默认)更改为 0?

最佳答案

使用 WithWriteConcern MongoCollection 对象上的方法以获取新的 IMongoCollection 对象,该对象将使用提供的写入关注进行查询。

 var jobInfoDocumentsCareless = jobInfoDocuments.WithWriteConcern(WriteConcern.Unacknowledged);
await jobInfoDocumentsCareless.BulkWriteAsync(operationList, writeOptions);

关于c# - 如何修改写关注级别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36286590/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com