Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

C# Driver QueryDocument?

There is no QueryDocument in the MongoDB.Driver.QueryDocument namespace…
https://mongodb.github.io/mongo-csharp-driver/2.10/apidocs/html/T_MongoDB_Driver_QueryDocument.htm

Why??

Hi @Francis_Beaulieu, welcome!

The assembly information on the API doc states:

Namespace:  MongoDB.Driver
Assembly:  MongoDB.Driver.Legacy (in MongoDB.Driver.Legacy.dll) Version: 2.10.0+569905ff5e778c38ea19d9d0392496a83e1704ed

This means that this is part of the legacy package of MongoDB .NET/C# driver. You need to import the NuGet package mongocsharpdriver into your project as below example:

<PackageReference Include="mongocsharpdriver" Version="2.10.3" />

You’re likely to have imported the new driver package MongoDB.Driver into your csproj file instead. This would be the recommended package if you’re starting a new project.

Regards,
Wan.

2 Likes

Thanks a lot Wan!

It’s a little bit annoying all those packages, I don’t know why they mix us with so many packages…!?

Anyway, in the MongoDB documentation, no mention of the right package to import, and in the NuGet package manager the first one if we search mongodb, is the other one… Should be improved may be?

Regards ans Thanks again! :wink: