Esempio n. 1
0
        public async Task <IReadOnlyList <(DomainId SchemaId, DomainId Id, Status Status)> > QueryIdsAsync(DomainId appId, DomainId schemaId, FilterNode <ClrValue> filterNode)
        {
            Guard.NotNull(filterNode, nameof(filterNode));

            try
            {
                var schema = await appProvider.GetSchemaAsync(appId, schemaId, false);

                if (schema == null)
                {
                    return(new List <(DomainId SchemaId, DomainId Id, Status Status)>());
                }

                var filter = BuildFilter(appId, schemaId, filterNode.AdjustToModel(appId));

                var contentItems = await Collection.FindStatusAsync(filter);

                return(contentItems.Select(x => (x.IndexedSchemaId, x.Id, x.Status)).ToList());
            }
            catch (MongoCommandException ex) when(ex.Code == 96)
            {
                throw new DomainException(T.Get("common.resultTooLarge"));
            }
            catch (MongoQueryException ex) when(ex.Message.Contains("17406"))
            {
                throw new DomainException(T.Get("common.resultTooLarge"));
            }
        }
        public async Task <IReadOnlyList <Guid> > QueryIdsAsync(Guid appId, ISchemaEntity schema, FilterNode filterNode)
        {
            var filter = filterNode.AdjustToModel(schema.SchemaDef, true).ToFilter(schema.Id);

            var contentEntities =
                await Collection.Find(filter).Only(x => x.Id)
                .ToListAsync();

            return(contentEntities.Select(x => Guid.Parse(x["_id"].AsString)).ToList());
        }
Esempio n. 3
0
        public async Task <IReadOnlyList <(Guid SchemaId, Guid Id)> > QueryIdsAsync(ISchemaEntity schema, FilterNode <ClrValue> filterNode)
        {
            var filter = filterNode.AdjustToModel(schema.SchemaDef, true).ToFilter(schema.Id);

            var contentEntities =
                await Collection.Find(filter).Only(x => x.Id, x => x.IndexedSchemaId)
                .ToListAsync();

            return(contentEntities.Select(x => (Guid.Parse(x["_si"].AsString), Guid.Parse(x["_id"].AsString))).ToList());
        }