KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In the documentation for MongoClient , MongoServer , MongoDatabase and MongoCollection<T> I see that it's said that they are thread-safe. Question: Does that mean I can have (for example) static fields of them in a class and access them from any Task / Thread ? Like: public static MongoClient Client = new MongoClient(Properties.Settings.Default.MongoConnStr); public static MongoServer Server = Client.GetServer(); public static MongoDatabase DraftDB = Server.GetDatabase("draftdb"); public static MongoCollection<MyDoc> Docs = Program.DraftDB.GetCollection<Location>("mydocs"); Specially about MongoCollection<T> ; I want to be sure that something like var cursor = Docs.Find(query).SetLimit(50); does not perform a mutation on the MongoCollection<T> (It's static state to be precise).
Tags (comma-separated)
Save Edits
Cancel