message contains no documents code:13066 mongdb数据库报的错误
message contains no documents code:13066
stackoverflow上面的回答是:
What version of the C# driver are you using? Can you provide a stack trace?
Is there any chance you are calling InsertBatch with an empty batch?
然后看过自己的代码,发现在用InsertBatch方法时,参数items数据集中没有数据,导致会报上面那个错误,于是加上判断是否有数据,然后就数据库就没报这个错误了。
public void AddBatch(IEnumerable<T> items) { _session.InsertBatch<T>(items); }