我從Mongo數據庫檢索文檔並將其複製到內部存儲。我發現檢索並存儲上百個這些文檔需要幾秒鐘的時間。有什麼我可以做的改善表現?一些集合有超過1000個文檔。這裏是我有(用vb.net寫的)如何提高Mongo文檔檢索性能
' get the documents from collection "reqitems" and put them in "collection"
Dim collection As IFindFluent(Of BsonDocument, BsonDocument) = _
reqitems.Find(Builders(Of BsonDocument).Filter.Empty)
ReDim model.ReqItems(TotalCollection.ToList.Count) ' storage for the processed documents
For Each item As BsonDocument In TotalCollection.ToList()
' note: given a string a=x, "GetRHS" returns x
Dim parentuid As String = GetRHS(item.GetElement("parentuid").ToString)
Dim nodename As String = GetRHS(item.GetElement("nodename").ToString)
' .... about a dozen of these elements
' .... process the elements and copy them to locations in model.ReqItems
next