[.NET Driver] "Disconnecting" an object from MongoDB

16 views
Skip to first unread message

Karsten Kaehler

unread,
May 4, 2016, 9:31:44 AM5/4/16
to mongodb-user
Hi folks,
I need some help!


If I try something like this

     var collection = _database.GetCollection<SomeObject>("Records");

     
foreach (SomeObject s in collection.ToList())
     
{
         anotherObject
.SomeProperty = s.SomeProperty;
     
}


where anotherObject is not mapped to a MongoDb Collection I get an access to the database everytime I try to read from anotherObject.SomeProperty, which gives me a huge performance hit.
How can I get rid of this behaviour?

Many thanks!

Wan Bachtiar

unread,
May 9, 2016, 1:20:26 AM5/9/16
to mongodb-user

where anotherObject is not mapped to a MongoDb Collection I get an access to the database everytime I try to read from anotherObject.SomeProperty, which gives me a huge performance hit.

Hi Karsten,

Could you please answer the following:

  • How do you observe the “access to the database” every time you read anotherObject.SomeProperty?
  • How do you measure the performance hit ?
  • What is the value type of SomeProperty ? i.e. is it another object ?
  • Could you provide example mapping of the classes ?
  • Which version of MongoDB C# driver are you using ?

Kind regards,

Wan.

Reply all
Reply to author
Forward
0 new messages