[CSHARP-442] how to convert "MongoDB.Bson.BsonValue" to "System.Data.Linq.Binary" using C#? Created: 13/Apr/12  Updated: 05/Apr/19  Resolved: 19/Apr/12

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

Type: Task Priority: Critical - P2
Reporter: mahendar.gunda Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CSHARP-443 how to convert "MongoDB.Bson.BsonValu... Closed

 Description   

foreach (BsonDocument item in VillageColl.FindAll())
{
Village ObjVillage = new Village();

var test = item.GetElement("Village_Map").Value.ToString();

ObjVillage.Village_ID = item.GetElement("Village_ID").Value.ToString();
ObjVillage.Taluka_ID = item.GetElement("Taluka_ID").Value.ToString();
ObjVillage.Village_Name = item.GetElement("Village_Name").Value.ToString();
ObjVillage.Village_Map = item.GetElement("Village_Map").Value;
ObjVillage.Subcenter_ID = Convert.ToDecimal(item.GetElement("Subcenter_ID").Value);**** Here i getting conversion error i.e. Con't implicitly convert "MongoDB.Bson.BsonValue" to "System.Data.Linq.Binary".



 Comments   
Comment by Brian [ 03/May/12 ]

Use BsonValue.RawValue instead of Value and let the dark side of the Force be with you.

Comment by Robert Stam [ 13/Apr/12 ]

Please post questions to the Google Group:

https://groups.google.com/forum/?fromgroups#!forum/mongodb-user

The JIRA system is for reporting bugs, not for asking questions about how to use the system.

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