KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm inserting raw JSON into a collection and finding that what is stored in the database is missing the values. For example, my collection is a collection of BsonDocuments : _products = database.GetCollection<BsonDocument>("products"); The code to insert the JSON into the collection: public int AddProductDetails(JObject json) { var doc = json.ToBsonDocument(DictionarySerializationOptions.Document); _products.Insert(doc); } The JSON that is passed in looks like this: { "Id": 1, "Tags": [ "book", "database" ], "Name": "Book Name", "Price": 12.12 } But, what is persisted in the collection is just the properties with no values. { "_id": { "$oid": "5165c7e10fdb8c09f446d720" }, "Id": [], "Tags": [ [], [] ], "Name": [], "Price": [] } Why are the values being dropped?
Tags (comma-separated)
Save Edits
Cancel