예제 #1
0
 public static QueryComplete NEIgnoreCase(string fieldName, object value)
 {
     if (value is string)
     {
         return(QueryBuilder.Query.Not(fieldName).Matches(new BsonRegularExpression("^" + Regex.Escape(value.ToString()) + "$", "i")));
     }
     {
         return(QueryBuilder.Query.NE(fieldName, BsonHelper.Create(value)));
     }
 }
예제 #2
0
        public static UpdateDocument ToUpdateDocument(this TextContent content)
        {
            UpdateDocument doc = new UpdateDocument();

            foreach (var item in content)
            {
                doc[item.Key] = BsonHelper.Create(item.Value);
            }
            return(doc);
        }
예제 #3
0
        public static UpdateDocument ToUpdateDocument(this TextContent textContent)
        {
            textContent = textContent.ConvertToUTCTime();
            UpdateDocument doc = new UpdateDocument();

            foreach (var item in textContent)
            {
                doc[item.Key] = BsonHelper.Create(item.Value);
                doc[GetCaseInsensitiveFieldName(item.Key)] = BsonHelper.Create(ToCaseInsensitiveValue(item.Value));
            }
            return(doc);
        }
예제 #4
0
 public static IMongoQuery ToQuery(this Category category)
 {
     return(Builders.Query.And(Builders.Query.EQ("CategoryFolder", BsonHelper.Create(category.CategoryFolder)),
                               Builders.Query.EQ("CategoryUUID", BsonHelper.Create(category.CategoryUUID)),
                               Builders.Query.EQ("ContentUUID", BsonHelper.Create(category.ContentUUID))));
 }
예제 #5
0
        public static IMongoQuery NEIgnoreCase(string fieldName, object value)
        {
            value = ModelExtensions.ToCaseInsensitiveValue(value);

            return(QueryBuilder.Query.NE(ModelExtensions.GetCaseInsensitiveFieldName(fieldName), BsonHelper.Create(value)));
        }