Exemple #1
0
        public void Add(Interaction entry)
        {
            BsonDocument document = SparkBsonHelper.ToBsonDocument(entry);

            Supercede(entry.Key);
            collection.Save(document);
        }
Exemple #2
0
        public void Add(Entry entry)
        {
            BsonDocument document = SparkBsonHelper.ToBsonDocument(entry);

            Supercede(entry.Key);
            collection.InsertOne(document);
        }
Exemple #3
0
        public async Task Add(Entry entry)
        {
            BsonDocument document = SparkBsonHelper.ToBsonDocument(entry);

            await Supercede(entry.Key).ConfigureAwait(false);

            await _collection.InsertOneAsync(document).ConfigureAwait(false);
        }
 public static IEnumerable <Entry> ToEntries(this MongoCursor <BsonDocument> cursor)
 {
     foreach (BsonDocument document in cursor)
     {
         Entry entry = SparkBsonHelper.ToEntry(document);
         yield return(entry);
     }
 }
Exemple #5
0
 public static IEnumerable <Interaction> ToInteractions(this MongoCursor <BsonDocument> cursor)
 {
     foreach (BsonDocument document in cursor)
     {
         Interaction entry = SparkBsonHelper.ToInteraction(document);
         yield return(entry);
     }
 }
Exemple #6
0
        public void Replace(Interaction entry)
        {
            string versionid = entry.Resource.Meta.VersionId;

            IMongoQuery  query       = MonQ.Query.EQ(Field.VERSIONID, versionid);
            BsonDocument current     = collection.FindOne(query);
            BsonDocument replacement = SparkBsonHelper.ToBsonDocument(entry);

            SparkBsonHelper.TransferMetadata(current, replacement);

            IMongoUpdate update = MonQ.Update.Replace(replacement);

            collection.Update(query, update);
        }