This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dbor_schemas.models import NoodleTutoringOrganization | |
from django.db.models import Count | |
to = NoodleTutoringOrganization.objects.annotate(Count('primary_profile')) | |
for tutor_org in to: | |
print tutor_org.name, "tutors", tutor_org.primary_profile__count | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dborutils.mongo_client import NoodleMongoClient | |
from dborutils.key_service import NoodleKeyService | |
# Requires dborutils v0.2.2 | |
collection_spec = "localhost:graduate:production" | |
namespace_client = NoodleMongoClient.create_from_mongo_spec(collection_spec) | |
# this returns the production collection from your client spec. | |
collection = namespace_client.collection() |