[CSHARP-639] CollectionStatsResult.MaxDocuments throws an InavlidCastException for capped collections Created: 06/Dec/12  Updated: 20/Mar/14  Resolved: 08/Dec/12

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.7
Fix Version/s: 1.8

Type: Bug Priority: Major - P3
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CSHARP-665 MaxDocuments is Int64 Closed

 Description   

The driver is expecting the server to return MaxDocuments as an Int32, but it's actually being returned as a Double, which is causing an InvalidCastException.

Make the driver able to deal with MaxDocuments returned as any numeric type (by calling ToInt32 instead of AsInt32).



 Comments   
Comment by auto [ 10/Dec/12 ]

Author:

{u'date': u'2012-12-07T04:30:48Z', u'email': u'robert@10gen.com', u'name': u'rstam'}

Message: CSHARP-639: Use ToInt32 instead of AsInt32 to make the driver be more tolerant of the server returning numeric values using different types.

Conflicts:
MongoDB.Driver/CommandResults/CollectionStatsResult.cs
Branch: x2.0
https://github.com/mongodb/mongo-csharp-driver/commit/3f9496165b486edcbf88eb65364a330b2abc24de

Comment by Robert Stam [ 08/Dec/12 ]

Pushed to master.

Comment by auto [ 07/Dec/12 ]

Author:

{u'date': u'2012-12-07T04:30:48Z', u'email': u'robert@10gen.com', u'name': u'rstam'}

Message: CSHARP-639: Use ToInt32 instead of AsInt32 to make the driver be more tolerant of the server returning numeric values using different types.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/4f1050fe7b0a97bfa4aeee4f0a90a0f2afea5306

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