예제 #1
0
        public List <ClientMetric> GetMetrics(Guid clientID)
        {
            List <ClientMetric>             result     = new List <ClientMetric>();
            IMongoDatabase                  database   = GetDatabase(DATABASE_NAME, false);
            IMongoCollection <BsonDocument> collection = database.GetCollection <BsonDocument>(CLIENT_METRICS_COLLECTION);
            BsonDocument doc = collection.Find(Builders <BsonDocument> .Filter.Eq("_id", clientID.ToByteArray())).FirstOrDefault();

            if (doc != null)
            {
                foreach (BsonDocument embeddedDocument in BsonHelper.GetArray(doc, "Metrics"))
                {
                    result.Add(LoadClientMetric(clientID, embeddedDocument));
                }
            }
            return(result);
        }
예제 #2
0
        public List <OrganisationMetric> GetMetrics(int organisationID)
        {
            List <OrganisationMetric>       result     = new List <OrganisationMetric>();
            IMongoDatabase                  database   = GetDatabase(DATABASE_NAME, false);
            IMongoCollection <BsonDocument> collection = database.GetCollection <BsonDocument>(ORGANISATION_METRICS_COLLECTION);
            BsonDocument doc = collection.Find(Builders <BsonDocument> .Filter.Eq("_id", organisationID)).FirstOrDefault();

            if (doc != null)
            {
                foreach (BsonDocument embeddedDocument in BsonHelper.GetArray(doc, "Metrics"))
                {
                    result.Add(LoadOrganisationMetric(organisationID, embeddedDocument));
                }
            }
            return(result);
        }