[CSHARP-249] GetIndexes should return instance of GetIndexesResult Created: 13/Jun/11  Updated: 02/Apr/15  Resolved: 11/Oct/11

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.0
Fix Version/s: 1.3

Type: Improvement Priority: Minor - P4
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Major Change

 Description   

GetIndexes is currently returning a value of type IEnumerable<BsonDocument>, requiring the caller to know the structure of the returned BsonDocuments and to write code to decode them. Most commands return type safe result types that have methods and properties that safely decode the results for the caller. GetIndexes should return a value of type GetIndexesResult, which would allow users to access the results of GetIndexes in a type safe manner and with assistance from Intellisense.

This is a backward breaking change. Maybe it could be made non-breaking in some way (for example by having GetIndexesResult derive from IEnumerable<BsonDocument>, which we normally wouldn't do).



 Comments   
Comment by Robert Stam [ 11/Oct/11 ]

GetIndexes now returns a GetIndexesResult, which implements IEnumerable<IndexInfo> and NOT IEnumerable<BsonDocument>. This provides type safe access to the results of GetIndexes.

If you want to work with the original IEnumerable<BsonDocument> result, use GetIndexes().RawDocuments.

This change is backward breaking, but you have the choice of simply using the RawDocuments property of GetIndexesResult and leaving the rest of your code unchanged, or you can change your code to use the type safe access to information about the indexes provided by GetIndexesResult and IndexInfo.

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