internal async Task createDoc() { Mongo_OptionSpreadExpression osefdb = new Mongo_OptionSpreadExpression(); osefdb.cqgSymbol = "test"; string json = Newtonsoft.Json.JsonConvert.SerializeObject(osefdb); //Bsondo MongoDB.Bson.BsonDocument document = MongoDB.Bson.Serialization.BsonSerializer.Deserialize <BsonDocument>(json); var collection = _database.GetCollection <BsonDocument>("mongoDataCollection"); await collection.InsertOneAsync(document); }
private void testLoadIn() { MongoDBConnectionAndSetup mongoDBConnectionAndSetup = new MongoDBConnectionAndSetup(); Mongo_OptionSpreadExpression osefdb = new Mongo_OptionSpreadExpression(); osefdb.cqgSymbol = "F.EPU16"; osefdb.instrument = cqgDataManagement.instrumentHashTable[11]; //mongoDBConnectionAndSetup.MongoDataCollection.ReplaceOne( // item => item.cqgSymbol == osefdb.cqgSymbol, // osefdb, // new UpdateOptions { IsUpsert = true }); mongoDBConnectionAndSetup.MongoDataCollection.InsertOne(osefdb); }