public void WriteToMongo() { var collection = MongoDBManager.GetCollections(collectionName); foreach (var data in dict) { FingerPrintList result = new FingerPrintList(); result.FingerPrint = data.Key; result.CollectionTag = collectionTag; result.Items = data.Value; collection.Insert(result); } }
public void PutbackItemList(int fingerPrint, IDAndPubInfo[] items) { var collection = MongoDBManager.GetCollections(collectionName); IMongoQuery query = Query.And(Query.EQ("FingerPrint", fingerPrint), Query.EQ("CollectionTag", collectionTag)); var result = collection.FindOneAs<FingerPrintList>(query); if (result != null) collection.Remove(query, SafeMode.False); result = new FingerPrintList(); result.FingerPrint = fingerPrint; result.CollectionTag = collectionTag; result.Items = items; collection.Insert(result, SafeMode.False); }