MongoDB C#驱动程序“未找到游标" [英] MongoDB C# Driver 'Cursor not found'

查看:84
本文介绍了MongoDB C#驱动程序“未找到游标"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常密集的操作,其中MongoCursor循环运行了几个小时(在通过c#驱动程序运行的vb.net应用程序上.我不太确定是什么原因导致的,但是我遇到了过一会儿就会出现异常

I have quite an intensive operation that has a MongoCursor run in a loop for a few hours (on a vb.net app running via the c# driver. I'm not too sure what causes it but I run into an exception after a while

Cursor not found

这可能是因为游标超时吗?有什么办法可以阻止这种情况的发生吗?如果出现超时问题,我该如何设置更长的超时时间?

This could be because of a cursor timeout, perhaps? Is there a way I can stop it happening? If its a timeout issue how do I place a longer timeout?

推荐答案

您可以通过以下方法在C#驱动程序中禁用光标的超时:

You can disable the cursor's timeout in the C# driver by calling:

cursor.SetFlags(QueryFlags.NoCursorTimeout);

否则,它会在闲置10分钟后关闭.

Otherwise it will be closed after 10 minutes of inactivity.

参考

这篇关于MongoDB C#驱动程序“未找到游标"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆