[CSHARP-1606] Error using Select function Created: 17/Mar/16  Updated: 05/Apr/19  Resolved: 05/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: Eddy Nakamura Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Development environment: Windows 10, Visual Studio 2013 Update 5
Production environment: Windows Server 2012 R2


Attachments: Zip Archive MongoDbTest.zip    
Issue Links:
Duplicate
duplicates CSHARP-1555 Projecting from and to the same type ... Closed
Backwards Compatibility: Fully Compatible

 Description   

Attached we have a Model.cs with a basic example and a Service class where I centralized all my database connections and functions.

In the Service class I'm trying to get less fields from my collection using "Select" function, supposing that my collection have three fields (as we can see in the Model.cs).

When the code execute the lines between 20-24, we get the following error: "Additional information: Element 'Id' does not match any field or property of class MongoTestClass".

But, if I remove the lines (20-24), we will get everything working fine.



 Comments   
Comment by Eddy Nakamura [ 25/Mar/16 ]

Hi Craig,

just attached a full project which can insert, but, when i Select the Id field, i get the error I told.

Can you try?

Thanks.
Eddy

Comment by Craig Wilson [ 24/Mar/16 ]

Hi Eddy,

I've attempted to reproduce this but failed. Would you mind providing a minimal console application (program.cs) that I can just run to see this fail?

Craig

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