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