当前位置: 首页>>代码示例>>C#>>正文


C# IMongoQuery类代码示例

本文整理汇总了C#中IMongoQuery的典型用法代码示例。如果您正苦于以下问题:C# IMongoQuery类的具体用法?C# IMongoQuery怎么用?C# IMongoQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IMongoQuery类属于命名空间,在下文中一共展示了IMongoQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Extract

        public IObservable<ParkingArea> Extract(IMongoQuery query)
        {
            return Observable.Create<ParkingArea>(async observer =>
            {
                var totalEntitiesToProcess  = serverProvider.Database.OsmCompoundQueryCount(query);
                var operationCounter        = new OperationCounter(log, string.Format("OSM Parking Area Extraction from {0}",query), totalEntitiesToProcess);
                var cursor                  = serverProvider.Database.OsmCompoundQuery(query);

                foreach (var entity in cursor)
                {
                    var entityContext   = new OsmEntityContext(serverProvider.Database, entity);
                    var parkingArea     = new ParkingArea() { Id = Guid.NewGuid(), Source = ParkingAreaSource.Maps, Confidence = configuration.Model.Confidence };
                    var isValid         = true;

                    foreach (var extractionRule in extractionRules)
                    {
                        var continueExtraction = await extractionRule.Extract(entityContext, parkingArea);

                        if (!continueExtraction)
                        {
                            log.Info("Entity {0} was dropped from extraction by rule {1}", entity, extractionRule.GetType().Name.Replace("Extraction", string.Empty).Replace("Rule", string.Empty));
                            isValid = false;
                            break;
                        }
                    }

                    if (isValid)
                    {
                        observer.OnNext(parkingArea);
                    }

                    operationCounter.Increment();
                }
            });
        }
开发者ID:BernhardGlueck,项目名称:Phare,代码行数:35,代码来源:OsmEntityExtractor.cs

示例2: Random

        public static List<供应商> 抽选供应商(int count, IMongoQuery conditions, IEnumerable<long> selected, IEnumerable<long> avoid)
        {
            var ret = new List<供应商>(count);
            var rnd = new Random();

            conditions = conditions.And(Query<供应商>.EQ(o => o.审核数据.审核状态, 审核状态.审核通过));
            if (null != selected && 0 != selected.Count())
            {
                var q = Query.NotIn("_id", new BsonArray(selected));
                conditions = Query.And(conditions, q);
            }
            if (null != avoid && 0 != avoid.Count())
            {
                var q = Query.NotIn("_id", new BsonArray(avoid));
                conditions = Query.And(conditions, q);
            }
            int total = (int)Mongo.计数<供应商>(0, 0, conditions);
            if (total < count) return new List<供应商>();
            var r = Mongo.查询<供应商>(0, 0, conditions);
            var ns = new HashSet<int>();
            for (int i = 0; i < count; i++)
            {
                int n;
                do
                {
                    n = rnd.Next(total);
                } while (ns.Contains(n));
                ret.Add(r.ElementAt(n));
                ns.Add(n);
            }
            return ret;
        }
开发者ID:269378737,项目名称:extractsystem,代码行数:32,代码来源:GysExtractManage.cs

示例3: MongoDeleteMessage

 // constructors
 internal MongoDeleteMessage(BsonBinaryWriterSettings writerSettings, string collectionFullName, RemoveFlags flags, IMongoQuery query)
     : base(MessageOpcode.Delete, null, writerSettings)
 {
     _collectionFullName = collectionFullName;
     _flags = flags;
     _query = query;
 }
开发者ID:moonreplace,项目名称:mongo-csharp-driver,代码行数:8,代码来源:MongoDeleteMessage.cs

示例4: GetAllTags

        public IEnumerable<KeyValuePair<string, IEnumerable<string>>> GetAllTags(IMongoQuery query)
        {
            var dataSet = new Dictionary<string, HashSet<string>>(StringComparer.OrdinalIgnoreCase);

            foreach (var entity in serverProvider.Database.OsmCompoundQuery(query))
            {
                foreach (var tag in entity.Tags)
                {
                    if (!dataSet.ContainsKey(tag.Key))
                    {
                        dataSet.Add(tag.Key, new HashSet<string>(StringComparer.OrdinalIgnoreCase));
                    }

                    var valueSet = dataSet[tag.Key];
                    if (!valueSet.Contains(tag.Value))
                    {
                        valueSet.Add(tag.Value);
                    }
                }
            }

            var result = dataSet.Select(kv => new KeyValuePair<string, IEnumerable<string>>(kv.Key, kv.Value));

            return result;
        }
开发者ID:BernhardGlueck,项目名称:Phare,代码行数:25,代码来源:OsmEntityTagsExtractor.cs

示例5: Remove

        public bool Remove(IMongoQuery query)
        {
            if (query == null)
                throw new ArgumentNullException("Collection must not be null");

            return _connection.GetCurrentCollection().Remove(query).Ok;
        }
开发者ID:jsouthron,项目名称:nosql,代码行数:7,代码来源:NoSqlRemover.cs

示例6: OsmCompoundQueryCount

        public static long OsmCompoundQueryCount(this MongoDatabase database,IMongoQuery query)
        {
            var r1 = database.GetOsmCollection(OsmEntityType.Node).FindAs<OsmNode>(query);
            var r2 = database.GetOsmCollection(OsmEntityType.Way).FindAs<OsmWay>(query);
            var r3 = database.GetOsmCollection(OsmEntityType.Relation).FindAs<OsmRelation>(query);

            return r1.Count() + r2.Count() + r3.Count();
        }
开发者ID:BernhardGlueck,项目名称:Phare,代码行数:8,代码来源:OsmDatabaseExtensions.cs

示例7:

 public static IEnumerable<新闻> 查询图片新闻(int skip, int limit, IMongoQuery conditions = null)
 {
     var q = Query.SizeGreaterThan("内容主体.图片", 0);
     if (conditions != null)
     {
         q = q.And(conditions);
     }
     return Mongo.查询<新闻>(skip, limit,q , true, null, false, false);
 }
开发者ID:269378737,项目名称:go81,代码行数:9,代码来源:新闻管理.cs

示例8: MongoUpdateMessage

 // constructors
 internal MongoUpdateMessage(BsonBinaryWriterSettings writerSettings, string collectionFullName, bool checkUpdateDocument, UpdateFlags flags, IMongoQuery query, IMongoUpdate update)
     : base(MessageOpcode.Update, null, writerSettings)
 {
     this.collectionFullName = collectionFullName;
     this.checkUpdateDocument = checkUpdateDocument;
     this.flags = flags;
     this.query = query;
     this.update = update;
 }
开发者ID:kamaradclimber,项目名称:mongo-csharp-driver,代码行数:10,代码来源:MongoUpdateMessage.cs

示例9: MongoQueryMessage

 internal MongoQueryMessage(BsonBuffer buffer, BsonBinaryWriterSettings writerSettings, string collectionFullName, QueryFlags flags, int numberToSkip, int numberToReturn, IMongoQuery query, IMongoFields fields)
     : base(MessageOpcode.Query, buffer, writerSettings)
 {
     this.collectionFullName = collectionFullName;
     this.flags = flags;
     this.numberToSkip = numberToSkip;
     this.numberToReturn = numberToReturn;
     this.query = query;
     this.fields = fields;
 }
开发者ID:kamaradclimber,项目名称:mongo-csharp-driver,代码行数:10,代码来源:MongoQueryMessage.cs

示例10: GeoQuery

        public static IMongoQuery GeoQuery(MongoLocation loc, double prox, IMongoQuery query)
        {
            var locQuery = QueryConstants.GeoQuery(loc, prox);

            var q = new QueryDocument();
            q.AddRange(BsonDocument.Parse(locQuery.ToString()));
            if (query != null) q.AddRange(BsonDocument.Parse(query.ToString()));

            return q;
        }
开发者ID:jsouthron,项目名称:nosql,代码行数:10,代码来源:QueryConstants.cs

示例11: GetPageViewsByUserAgent

        private ICollection<KeyValuePair<string, int>> GetPageViewsByUserAgent(IMongoQuery query)
        {
            var reduce = new BsonJavaScript("function(o, agg) { agg.count++; }");
            var results = DB.PageViews.Group(query, "UserAgent", new { count = 0 }.ToBsonDocument(), reduce, null).ToList();

            return results
                .ToKeyValuePairs(x => x["UserAgent"].AsString, x => x["count"].ToInt32())
                .OrderByDescending(kvp => kvp.Value)
                .ToList();
        }
开发者ID:lgadi,项目名称:ZeeBi,代码行数:10,代码来源:StatsController.cs

示例12: MongoQueryMessage

 // constructors
 internal MongoQueryMessage(
     BsonBinaryWriterSettings writerSettings,
     string collectionFullName,
     QueryFlags flags,
     int numberToSkip,
     int numberToReturn,
     IMongoQuery query,
     IMongoFields fields)
     : this(null, writerSettings, collectionFullName, flags, numberToSkip, numberToReturn, query, fields)
 {
 }
开发者ID:CloudMetal,项目名称:mongo-csharp-driver,代码行数:12,代码来源:MongoQueryMessage.cs

示例13: MongoQueryMessage

 internal MongoQueryMessage(
     MongoServer server,
     string collectionFullName,
     QueryFlags flags,
     int numberToSkip,
     int numberToReturn,
     IMongoQuery query,
     IMongoFields fields
 ) :
     this(server, collectionFullName, flags, numberToSkip, numberToReturn, query, fields, null) {
 }
开发者ID:ebix,项目名称:mongo-csharp-driver,代码行数:11,代码来源:MongoQueryMessage.cs

示例14: SetQuery

 public void SetQuery(IMongoQuery mongoQuery)
 {
     if (this.MongoQuery != null)
     {
         this.MongoQuery = QueryBuilder.Query.And(this.MongoQuery, mongoQuery);
     }
     else
     {
         this.MongoQuery = mongoQuery;
     }
 }
开发者ID:kooboo-jifeng,项目名称:CMS,代码行数:11,代码来源:MongoDBVisitor.cs

示例15: MongoDeleteMessage

 internal MongoDeleteMessage(
     MongoServer server,
     string collectionFullName,
     RemoveFlags flags,
     IMongoQuery query
 ) :
     base(server, MessageOpcode.Delete) {
     this.collectionFullName = collectionFullName;
     this.flags = flags;
     this.query = query;
 }
开发者ID:ebix,项目名称:mongo-csharp-driver,代码行数:11,代码来源:MongoDeleteMessage.cs


注:本文中的IMongoQuery类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。