Esempio n. 1
0
        public static void CreateCateogryIndex(this Repository repository)
        {
            var collection = repository.GetCategoriesCollection();

            try
            {
                collection.EnsureIndex(ModelExtensions.GetCaseInsensitiveFieldName("ContentUUID"), ModelExtensions.GetCaseInsensitiveFieldName("CategoryFolder"), ModelExtensions.GetCaseInsensitiveFieldName("CategoryUUID"));
            }//ignore the index creating exception
            catch (Exception e)
            {
                Kooboo.HealthMonitoring.Log.LogException(e);
            }
        }
Esempio n. 2
0
        public static void CreateIndex(this Schema schema)
        {
            MongoCollection <BsonDocument> collection = schema.GetCollection();

            try
            {
                collection.EnsureIndex(ModelExtensions.GetCaseInsensitiveFieldName("FolderName"), ModelExtensions.GetCaseInsensitiveFieldName("UUID"), ModelExtensions.GetCaseInsensitiveFieldName("Published"));
                collection.EnsureIndex(ModelExtensions.GetCaseInsensitiveFieldName("FolderName"), ModelExtensions.GetCaseInsensitiveFieldName("UserKey"), ModelExtensions.GetCaseInsensitiveFieldName("Published"));
                collection.EnsureIndex(ModelExtensions.GetCaseInsensitiveFieldName("FolderName"), ModelExtensions.GetCaseInsensitiveFieldName("UUID"), ModelExtensions.GetCaseInsensitiveFieldName("Published"));
                collection.EnsureIndex(ModelExtensions.GetCaseInsensitiveFieldName("FolderName"), ModelExtensions.GetCaseInsensitiveFieldName("UserKey"), ModelExtensions.GetCaseInsensitiveFieldName("Published"));
                collection.EnsureIndex(ModelExtensions.GetCaseInsensitiveFieldName("FolderName"), ModelExtensions.GetCaseInsensitiveFieldName("ParentFolder"), ModelExtensions.GetCaseInsensitiveFieldName("ParentUUID"));
            }//ignore the index creating exception
            catch (Exception e)
            {
                Kooboo.HealthMonitoring.Log.LogException(e);
            }
        }
Esempio n. 3
0
        public static IMongoQuery NEIgnoreCase(string fieldName, object value)
        {
            value = ModelExtensions.ToCaseInsensitiveValue(value);

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