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); }
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))); } }
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); }
public static TextContent ToContent(this BsonDocument doc) { if (doc == null) { return(null); } TextContent content = new TextContent(); foreach (var item in doc) { if (item.Name != "_id") { content[item.Name] = BsonHelper.GetValue(doc[item.Name]); } } return(content); }
public static TextContent ToContent(this BsonDocument doc) { if (doc == null) { return(null); } TextContent content = new TextContent(); foreach (var item in doc) { if (item.Name != "_id" && !IsCaseInsensitiveFieldName(item.Name)) { content[item.Name] = BsonHelper.GetValue(doc[item.Name]); } } return(content.ConvertToLocalTime()); }
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)))); }
public static IMongoQuery NEIgnoreCase(string fieldName, object value) { value = ModelExtensions.ToCaseInsensitiveValue(value); return(QueryBuilder.Query.NE(ModelExtensions.GetCaseInsensitiveFieldName(fieldName), BsonHelper.Create(value))); }