Groups
Groups
Sign in
Groups
Groups
mongodb-user
Conversations
About
Send feedback
Help
How to convert BsonElement to BsonDocument in C#
498 views
Skip to first unread message
trypsin
unread,
Apr 29, 2012, 12:11:20 PM
4/29/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
I have a question like this:
my current bson document is like this:
{
_id: ********************
VehicleType: StarType
BrakeSystem: X Layout
}
and now I hope to put more information in the field of BrakeSystem
like this:
{
_id: ********************
VehicleType: StarType
{ BrakeSystem: X Layout, ABS: BOSCH ABS6}
}
so how can I convert the BsonElement to BsonDocument data? or Just
delete the original BrakeSystem field and nest the new BrakeSystem
document?
craiggwilson
unread,
Apr 29, 2012, 4:05:28 PM
4/29/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongod...@googlegroups.com
You wouldn't really convert it. You'd just overwrite it.
doc = collection.FindOne();
doc["BrakeSystem"] = new BsonDocument("BraokSystem", "X Layout").Add("ABS", "BOSCH ABS6");
collection.Save(doc);
trypsin
unread,
Apr 30, 2012, 9:46:35 AM
4/30/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
thanks, i just tried, it works!
Reply all
Reply to author
Forward
0 new messages