Reputation: 305
A mongo document can have a key with multiple values. For eg. Phone no can have several values. I want to insert this array with the help of c# driver API. Please tellme the way to insert such values. Thanks.
Upvotes: 0
Views: 146
Reputation: 12624
You can do this pretty easily.
BsonDocument doc = new BsonDocument();
BsonArray phones = new BsonArray();
phones.Add("123-456-7890");
phones.Add("234-567-8901");
doc.Add("phones", phones);
collection.Insert(doc);
If this isn't what you are looking for, please let us know.
Upvotes: 2