public void SetSelector(TQItemSelector selector) { this.selector = selector; this.QueryFeature = MongoSelector.GetQuery(this.selector); this.SortFeature = MongoSelector.GetSort(this.selector); OptimiseForSelector(); }
public TaskMessage GetItemFifo() { CheckConnection(); TaskQueue.TQItemSelector selector = TaskQueue.TQItemSelector.DefaultFifoSelector; var cursor = Collection.Find(MongoSelector.GetQuery(selector)).SetSortOrder(); cursor.Limit = 1; MongoMessage mms = cursor.FirstOrDefault(); if (mms == null)//empty { return(null); } TaskMessage msg = new TaskMessage(mms.ExtraElements); msg.Holder.Add("_id", mms.id.Value); return(msg); }