This results in "System.InvalidOperationException : WriteStartArray
can only be called when State is Value, not when State is Initial".
How do I convert 'items' into a valid argument for the Add() method?
Robert Stam
unread,
Jul 29, 2011, 10:39:19 PM7/29/11
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-csharp
ToBsonDocument works one document at a time, you can't call it on the
whole list.
You could write it like this:
List<MyItems> items;
var cust1 = new BsonDocument();
cust1.Add("Items", new BsonArray(items.Select(i =>
i.ToBsonDocument())));
Sandip Agrawal
unread,
May 22, 2018, 1:57:24 AM5/22/18
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