I have searched all over and no solution works. Here is how I am inserting data:
string value = db.StringGet("test");
string cleaned = value.Replace("u'", "'").Replace("\"", "");
var jsonDoc = Newtonsoft.Json.JsonConvert.SerializeObject(cleaned);
Dictionary<string, string> dict = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(jsonDoc);
values.Add(dict);
_collection.InsertMany(values.Select(x => x.ToBsonDocument()));
Here is how the data looks in the database
{
"_id" : ObjectId("5aaabf7ac03af44892673031"),
"_t" : "MongoDB.Bson.BsonDocument, MongoDB.Bson",
"_v" : {
"profile" : "myprofile",
"source" : "thesource",
"hostname" : "myhost",
"pgm" : "mypgm"
}
}
I dont want the data formatted like this in mongo. The reason my is because I have several clients accessing the db. I would rather have the data formatted like this:
{
"_id" : ObjectId("5aaabf7ac03af44892673031"),
"profile" : "myprofile",
"source" : "thesource",
"hostname" : "myhost",
"pgm" : "mypgm"
}