Beispiel #1
0
        public IList <Interaction> Get(IEnumerable <string> identifiers, string sortby)
        {
            var clauses = new List <IMongoQuery>();
            IEnumerable <BsonValue> ids = identifiers.Select(i => (BsonValue)i);

            clauses.Add(MonQ.Query.In(Field.PRIMARYKEY, ids));

            IMongoQuery query = MonQ.Query.And(clauses);
            MongoCursor <BsonDocument> cursor = collection.Find(query);

            if (sortby != null)
            {
                cursor = cursor.SetSortOrder(MonQ.SortBy.Ascending(sortby));
            }
            else
            {
                cursor = cursor.SetSortOrder(MonQ.SortBy.Descending(Field.WHEN));
            }

            return(cursor.ToInteractions().ToList());
        }