示例#1
0
    def __init__(self, collection='entities'):
        AMongoCollection.__init__(self, collection=collection, primary_key='entity_id', overflow=True)
        AEntityDB.__init__(self)

        fast_resolve_fields = ('sources.amazon_id', 'sources.spotify_id', 'sources.rdio_id',
                'sources.opentable_id', 'sources.tmdb_id', 'sources.factual_id', 'sources.instagram_id',
                'sources.singleplatform_id', 'sources.foursquare_id', 'sources.fandango_id', 'sources.googleplaces_id',
                'sources.itunes_id', 'sources.netflix_id', 'sources.thetvdb_id', 'sources.nytimes_id',
                'sources.umdmusic_id', 'sources.tombstone_id')
        for field in fast_resolve_fields:
            self._collection.ensure_index(field)

        self._collection.ensure_index([
                                    ('search_tokens',               pymongo.ASCENDING),
                                    ('sources.user_generated_id',   pymongo.ASCENDING),
                                    ('sources.tombstone_id',        pymongo.ASCENDING),
                                ])

        self._collection.ensure_index('search_tokens')
        self._collection.ensure_index('titlel')
        self._collection.ensure_index('albums.title')
        self._collection.ensure_index('artists.title')
        self._collection.ensure_index('authors.title')
        self._collection.ensure_index('tracks.title')

        self._collection.ensure_index([('_id', pymongo.ASCENDING), ('sources.user_generated_id', pymongo.ASCENDING)])

        self._cache = globalMemcache()
    def __init__(self):
        AMongoCollection.__init__(self, collection='accesstokens')
        AAuthAccessTokenDB.__init__(self)

        self._cache = globalMemcache()

        self._collection.ensure_index([('user_id', pymongo.ASCENDING)])
    def __init__(self):
        AMongoCollection.__init__(self, collection='activitylinks',
                                        primary_key='link_id', 
                                        obj=ActivityLink, 
                                        overflow=True)

        self._collection.ensure_index([('user_id', pymongo.ASCENDING), ('timestamp.modified', pymongo.ASCENDING)])
        self._collection.ensure_index([('activity_id', pymongo.ASCENDING),('user_id', pymongo.ASCENDING)])
示例#4
0
    def __init__(self, stack_name=None):
        # Change collection name to stack if on EC2
        collection = "logs"
        if stack_name is not None:
            collection = "logs_%s" % stack_name
        elif libs.ec2_utils.is_ec2():
            stack_info = libs.ec2_utils.get_stack()
            collection = "logs_%s" % stack_info.instance.stack

        AMongoCollection.__init__(self, collection=collection, logger=True, isCapped=True)
示例#5
0
    def __init__(self):
        AMongoCollection.__init__(self, collection='comments', primary_key='comment_id', obj=Comment, overflow=True)
        ACommentDB.__init__(self)

        self._collection.ensure_index('user.user_id')
        self._collection.ensure_index('timestamp.created')
        self._collection.ensure_index([('stamp_id', pymongo.ASCENDING)])
        self._collection.ensure_index([('_id', pymongo.ASCENDING), ('timestamp.created',pymongo.DESCENDING)])

        self._cache = globalMemcache()
示例#6
0
    def __init__(self, api):
        AMongoCollection.__init__(self, collection='users', primary_key='user_id', obj=User, overflow=True)
        AUserDB.__init__(self)
        
        self.api = api
        self._collection.ensure_index('phone')
        self._collection.ensure_index('linked.twitter.linked_user_id')
        self._collection.ensure_index('linked.facebook.linked_user_id')
        self._collection.ensure_index([('screen_name_lower', pymongo.ASCENDING), ('_id', pymongo.ASCENDING)])
        self._collection.ensure_index([('name_lower', pymongo.ASCENDING), ('_id', pymongo.ASCENDING)])

        self._cache = globalMemcache()
    def __init__(self):
        AMongoCollection.__init__(self, collection='activityitems', 
                                        primary_key='activity_id', 
                                        obj=Activity, 
                                        overflow=True)

        self._collection.ensure_index('timestamp.modified')
        self._collection.ensure_index([('subjects', pymongo.ASCENDING), ('_id', pymongo.ASCENDING)])
        self._collection.ensure_index([('verb', pymongo.ASCENDING), ('subjects', pymongo.ASCENDING), ('timestamp.modified', pymongo.DESCENDING)])
        self._collection.ensure_index([('verb', pymongo.ASCENDING), ('objects.stamp_ids', pymongo.ASCENDING), ('timestamp.created', pymongo.DESCENDING)])
        self._collection.ensure_index([('verb', pymongo.ASCENDING), ('objects.user_ids', pymongo.ASCENDING), ('timestamp.created', pymongo.DESCENDING)])
        self._collection.ensure_index([('verb', pymongo.ASCENDING), ('objects.entity_ids', pymongo.ASCENDING), ('timestamp.created', pymongo.DESCENDING)])
    def __init__(self):
        AMongoCollection.__init__(self, collection='rawactivityitems', 
                                        primary_key='activity_id', 
                                        obj=RawActivity, 
                                        overflow=True)

        self._collection.ensure_index('timestamp.modified')

        self._collection.ensure_index([ ('verb', pymongo.ASCENDING), 
                                        ('subject', pymongo.ASCENDING), 
                                        ('objects.user_id', pymongo.ASCENDING), 
                                        ('objects.stamp_id', pymongo.ASCENDING), 
                                        ('objects.entity_id', pymongo.ASCENDING), 
                                        ('objects.comment_id', pymongo.ASCENDING) ], unique=True)
示例#9
0
    def __init__(self):
        AMongoCollection.__init__(self, 'users', primary_key='user_id', obj=Account, overflow=True)
        AAccountDB.__init__(self)
        
        ### TEMP: For now, verify that no duplicates can occur via index
        self._collection.ensure_index('screen_name_lower', unique=True)
        self._collection.ensure_index('email', unique=True)
        self._collection.ensure_index('name_lower')
        self._collection.ensure_index([('linked.facebook.linked_user_id', pymongo.ASCENDING),
                                        ('_id', pymongo.ASCENDING)])
        self._collection.ensure_index([('linked.twitter.linked_user_id', pymongo.ASCENDING),
                                        ('_id', pymongo.ASCENDING)])
        self._collection.ensure_index('linked.netflix.linked_user_id')

        self._cache = globalMemcache()
示例#10
0
    def __init__(self):
        AMongoCollection.__init__(self, collection='entitystats', primary_key='entity_id', obj=EntityStats)
        
        self._collection.ensure_index([ 
            ('types', pymongo.ASCENDING),
            ('score', pymongo.DESCENDING),
        ])
        self._collection.ensure_index([ 
            ('types', pymongo.ASCENDING),
            ('lat', pymongo.ASCENDING), 
            ('lng', pymongo.ASCENDING), 
            ('score', pymongo.DESCENDING),
        ])

        self._cache = globalMemcache()
示例#11
0
 def _convertToMongo(self, entity):
     if entity.entity_id is not None and entity.entity_id.startswith('T_'):
         del entity.entity_id
     document = AMongoCollection._convertToMongo(self, entity)
     if document is None:
         return None
     if 'title' in document:
         document['titlel'] = getSimplifiedTitle(document['title'])
     return document
示例#12
0
    def _convertFromMongo(self, document):
        if document is None:
            return None

        # Temporary transition (dev only - not necessary on prod)
        if 'updated' in document:
            if 'timestamp' not in document:
                document['timestamp'] = {'generated': document['update']}

        return AMongoCollection._convertFromMongo(self, document)
示例#13
0
    def _convertToMongo(self, account):
        document = AMongoCollection._convertToMongo(self, account)
        
        if 'screen_name' in document:
            document['screen_name_lower'] = str(document['screen_name']).lower()
        if 'name' in document and document['name'] is not None:
            document['name_lower'] = unicode(document['name']).lower()
        if 'phone' in document and document['phone'] is not None:
            document['phone'] = str(document['phone'])

        return document
示例#14
0
    def _convertToMongo(self, entity):
        if entity.entity_id is not None and entity.entity_id.startswith('T_'):
            del entity.entity_id

        # Extract search tokens
        searchTokens = generateSearchTokens(entity)

        # Convert document
        document = AMongoCollection._convertToMongo(self, entity)
        if document is None:
            return None

        # Add search tokens
        document['search_tokens'] = searchTokens

        # Add titlel
        if 'title' in document:
            document['titlel'] = getSimplifiedTitle(document['title'])

        return document
示例#15
0
    def __init__(self):
        AMongoCollection.__init__(self, collection="userlikes")

        self._cache = globalMemcache()
示例#16
0
 def __init__(self):
     AMongoCollection.__init__(self, collection='stampstats', primary_key='stamp_id', obj=StampStats)
     self._collection.ensure_index([ ('entity_id', pymongo.ASCENDING), ('last_stamped', pymongo.ASCENDING), ('score', pymongo.DESCENDING) ])
     self._collection.ensure_index([ ('last_stamped', pymongo.ASCENDING), ('score', pymongo.DESCENDING) ])
     self._collection.ensure_index([ ('entity_id', pymongo.ASCENDING), ('score', pymongo.DESCENDING) ])
     self._cache = globalMemcache()
示例#17
0
 def __init__(self):
     AMongoCollection.__init__(self, collection='tastemaker_whitelist', overflow=True)
    def __init__(self):
        AMongoCollection.__init__(self, collection="clientlogs", primary_key="entry_id", obj=ClientLogsEntry)

        self._collection.ensure_index("user_id", unique=False)
        self._collection.ensure_index("key", unique=False)
 def __init__(self):
     AMongoCollection.__init__(self, collection='inboxstamps')
 def __init__(self):
     AMongoCollection.__init__(self, collection='stamplikes')
     self._collection.ensure_index('ref_ids')
    def __init__(self):
        AMongoCollection.__init__(self, collection='creditreceived')

        self._collection.ensure_index([('credits.user.user_id', pymongo.ASCENDING)])
        self._collection.ensure_index([('ref_ids', pymongo.ASCENDING)])
 def __init__(self):
     AMongoCollection.__init__(self, 'invitations')
     self._collection.ensure_index([('_id', pymongo.ASCENDING), ('invited_by', pymongo.ASCENDING)])
    def __init__(self):
        AMongoCollection.__init__(self, collection='alertqueue', primary_key='alert_id', obj=Alert)
        # AAlertDB.__init__(self)

        self._collection.ensure_index('timestamp.created', unique=False)
        self._collection.ensure_index([('recipient_id',pymongo.ASCENDING), ('timestamp.created',pymongo.ASCENDING)])
 def __init__(self):
     AMongoCollection.__init__(self, collection='userlinkedalertshistory')
    def __init__(self):
        AMongoCollection.__init__(self, collection='settingsemailalerttokens')
        AAuthEmailAlertsDB.__init__(self)

        self._collection.ensure_index('token_id', unique=True)
    def __init__(self):
        AMongoCollection.__init__(self, collection='passwordreset')
        AAuthPasswordResetDB.__init__(self)

        self._collection.ensure_index([('user_id', pymongo.ASCENDING)])
 def __init__(self):
     AMongoCollection.__init__(self, collection='stampviews')
 def __init__(self):
     AMongoCollection.__init__(self, collection='rllog')
示例#29
0
 def __init__(self):
     AMongoCollection.__init__(self, collection='friends')
 def __init__(self):
     AMongoCollection.__init__(self, collection='userfbcallbacktokens')