[CSHARP-1631] Mongodb c# driver update - implemantation differences Created: 19/Apr/16  Updated: 05/Apr/19  Resolved: 19/Apr/16

Status: Closed
Project: C# Driver
Component/s: Linq
Affects Version/s: 2.2.3
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Bilgehan Assignee: Unassigned
Resolution: Done Votes: 0
Labels: question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Hi I want to upgrade my c# driver to 2.2.3 ,previous driver I use MongoCollection class and this class have RemoveAll,WriteConcernResult,FindAsAll etc... features.To use async methods I change IMongoCollection and that time implementations change.Which class should I use?What is difference between abstract class MongoCollection and interface IMongoCollection.Should I select one, will MongoCollection be obsolete next releases?Or Should I use both

Thanks



 Comments   
Comment by Craig Wilson [ 19/Apr/16 ]

We do not have that documentation. I think you'll find it's a fairly self-documenting API. For instance, to do a FindOneById, simply do a Find where you do an equality match on the identifier. Our documentation will walk you through the new API if you have any issues figuring out how to do something.

Craig

Comment by Bilgehan [ 19/Apr/16 ]

Hi Craig,

Do you have any documentation or sample project about that topic

for example MongoCollection.FindOneByIdAs old way,it is equivalent in IMongoCollection ...

Old api(MongoCollection) and what is its equvalient in new api(IMongoCollection)

Regards

Comment by Craig Wilson [ 19/Apr/16 ]

Hi Bilgehan,

We introduced a completely new API in version 2.0. We have maintained the legacy API (1.x) to make it easy for users to move to 2.x and not need to port their entire applications all at once. This legacy API will be maintained for the duration of the 2.x version. However, we will likely not maintain it in future major versions.

IMongoCollection is part of the new API and has both async and sync methods. MongoCollection is part of the legacy API and only support sync operations. You may use both at the same time if you wish. If you are needing to make choice, I would prefer the new API. It is cleaner and will be fully supported in the future.

Let me know if you have further questions,
Craig

Generated at Wed Feb 07 21:40:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.