我有一个从数据库mongodb获取数据的程序,但我没能得到下一个数据
此代码
Dim listOfBusiness = New Generic.List(Of Business)
Dim mongo As MongoServer = MongoServer.Create(otherComputerToServerSafeUpdate)
mongo.Connect()
Dim db = mongo.GetDatabase("namedatabase")
Using mongo.RequestStart(db)
Dim collection = db.GetCollection(Of BsonDocument)("tablebusiness")
Dim queryPlaces = query.WithinRectangle("LongitudeLatitude", (Longitude - minimumBlock), (Latitude - minimumBlock), (Longitude + minimumBlock), (Latitude + minimumBlock))
Dim ListCollectionBusinessCursor = collection.Find(queryPlaces)
For Each ReturnedDocument In ListCollectionBusinessCursor
Dim aBusiness = New Business(ReturnedDocument)
listOfBusiness.Add(aBusiness)
Next ReturnedDocument 'Got exception here
End Using
这是我的例外
Mongodb查询异常
QueryFailure flag was assertion db\key.cpp:409 (response was { "$err" : "assertion db\\key.cpp:409" })
我在mongodb shell中尝试查询,得到了13个结果
Queryplace="{ "LongitudeLatitude" : { "$within" : { "$box" : [[-80.293072110482868, 26.29], [-80.213072110482855, 26.369999999999997]] } } }"
问题是什么?为什么会这样?它偶尔会发生一次。
答案 0 :(得分:1)
我出现了此错误消息,解决方案正在修复数据库。
mongod --repair