0

我有一个从数据库 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 中尝试 queryplace,得到 13 个结果

Queryplace="{ "LongitudeLatitude" : { "$within" : { "$box" : [[-80.293072110482868, 26.29], [-80.213072110482855, 26.369999999999997]] } } }"

有什么问题,为什么会这样?它只偶尔发生一次。

4

1 回答 1

1

我收到此错误消息,解决方案是修复数据库。

mongod --repair

于 2012-11-13T15:47:06.333 回答