Store the collection information in the ACTIVE_INDEXES keys
This commit is contained in:
parent
3cd6ea5b17
commit
ca5d2c51b6
@ -20,9 +20,9 @@ Indexes for the local database.
|
||||
Indexes are recorded in the following format:
|
||||
|
||||
INDEXES = {
|
||||
'identifier': { # key identifier used for possibly deprecating later
|
||||
'collection': 'thiscollection',
|
||||
'index': [index_foo_goes_here]}}
|
||||
'collection_name': {
|
||||
'identifier': { # key identifier used for possibly deprecating later
|
||||
'index': [index_foo_goes_here]}}
|
||||
|
||||
... and anything else being parameters to the create_index function
|
||||
(including unique=True, etc)
|
||||
@ -34,6 +34,7 @@ Remember, ordering of compound indexes MATTERS. Read below for more.
|
||||
|
||||
REQUIRED READING:
|
||||
- http://kylebanker.com/blog/2010/09/21/the-joy-of-mongodb-indexes/
|
||||
|
||||
- http://www.mongodb.org/display/DOCS/Indexes
|
||||
- http://www.mongodb.org/display/DOCS/Indexing+Advice+and+FAQ
|
||||
"""
|
||||
@ -54,7 +55,6 @@ MEDIAENTRY_INDEXES = {
|
||||
# Matching an object to an uploader + slug.
|
||||
# MediaEntries are unique on these two combined, eg:
|
||||
# /u/${myuser}/m/${myslugname}/
|
||||
'collection': 'media_entries',
|
||||
'index': [('uploader', ASCENDING),
|
||||
('slug', ASCENDING)],
|
||||
'unique': True},
|
||||
@ -62,19 +62,16 @@ MEDIAENTRY_INDEXES = {
|
||||
'mediaentry_created': {
|
||||
# A global index for all media entries created, in descending
|
||||
# order. This is used for the site's frontpage.
|
||||
'collection': 'media_entries',
|
||||
'index': [('created', DESCENDING)]},
|
||||
|
||||
'mediaentry_uploader_created': {
|
||||
# Indexing on uploaders and when media entries are created.
|
||||
# Used for showing a user gallery, etc.
|
||||
'collection': 'media_entries',
|
||||
'index': [('uploader', ASCENDING),
|
||||
('created', DESCENDING)]}}
|
||||
|
||||
|
||||
ACTIVE_INDEXES.update(
|
||||
[MEDIAENTRY_INDEXES])
|
||||
ACTIVE_INDEXES['media_entries'] = MEDIAENTRY_INDEXES
|
||||
|
||||
|
||||
# User indexes
|
||||
@ -84,20 +81,18 @@ USER_INDEXES = {
|
||||
'user_username_unique': {
|
||||
# Index usernames, and make sure they're unique.
|
||||
# ... I guess we might need to adjust this once we're federated :)
|
||||
'collection': 'users',
|
||||
'index': 'username'},
|
||||
'index': 'username',
|
||||
'unique': True},
|
||||
'user_created': {
|
||||
# All most recently created users
|
||||
'collection': 'users',
|
||||
'index': 'created'}}
|
||||
|
||||
|
||||
ACTIVE_INDEXES.update(
|
||||
[USER_INDEXES])
|
||||
ACTIVE_INDEXES['users'] = USER_INDEXES
|
||||
|
||||
|
||||
####################
|
||||
# Deprecated indexes
|
||||
####################
|
||||
|
||||
DEPRECATED_INDEXES = []
|
||||
DEPRECATED_INDEXES = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user