I have a problem insert mongodb using vb.net.
Public Sub runMongoDBQuery(ByVal nameDatabase As String, ByVal nameCollection As String, ByVal queryBson As BsonDocument, ByVal serverString As String)
Dim mongo1 As MongoServer = MongoServer.Create("mongodb://localhost/?safe=true")
mongo1.Connect()
Dim db = mongo1.GetDatabase(nameDatabase)
Dim collection1 = db(nameCollection)
collection1.Save(queryBson)// this is hang
mongo1.Disconnect()
End Sub
When I user this function, it run smoothly and suddenly hang.
It doesn’t throw exception but hang.
The problems run very rarely.
All the function did is saving queryBson
I will:
- Check content of queryBson
- Check log of mongodb server
- Update the question once I got more info
I managed to solve this problem by restarting mongodb and deleting the log. Thanks to Cirrus’s comment.
The log is 3GB and I strongly suspected it’s the culprit.
Such a high log is useless because text editor can’t open it anyway. Deleting the log without restarting mongodb causes a side effect where logs are no longer created.
I will soon ask another question how to limit log for mongodb, maybe on the database forum.
This question has a sequel:
https://dba.stackexchange.com/questions/25658/how-to-keep-mongodb-log-small