Beispiel #1
0
        public static Query ID_EQ_BYTE_ARRAY(byte[] id)
        {
            var result = new Query();

            result.Set(DataDocConverter.ByteBufferID_CLRtoBSON(_ID, id));
            return(result);
        }
Beispiel #2
0
                                 private void putCore(string table, byte[] key, BSONElement value, int slidingExpirationDays, DateTime?absoluteExpirationDateUtc)
                                 {
                                     //todo: Why do we obtain ref to db on very put, need to consider cache for speed
                                     var db = App.GetMongoDatabaseFromConnectString(EffectiveConnectionString);

                                     var doc = new BSONDocument()
                                               .Set(DataDocConverter.ByteBufferID_CLRtoBSON(MongoQuery._ID, key))
                                               .Set(value)
                                               .Set(new BSONDateTimeElement(FIELD_LAST_USE_DATE, App.TimeSource.UTCNow))
                                               .Set(absoluteExpirationDateUtc.HasValue
                ? (BSONElement) new BSONDateTimeElement(FIELD_ABSOLUTE_EXPIRATION_DATEUTC, absoluteExpirationDateUtc.Value)
                : new BSONNullElement(FIELD_ABSOLUTE_EXPIRATION_DATEUTC))
                                               .Set(slidingExpirationDays > -1
                ? (BSONElement) new BSONInt32Element(FIELD_SLIDING_EXPIRATION_DAYS, slidingExpirationDays)
                : new BSONNullElement(FIELD_SLIDING_EXPIRATION_DAYS));

                                     db[table].Save(doc);
                                 }