Adding our current indexes and removing the index that was in models.py
This commit is contained in:
parent
0f3167c9f0
commit
b1db6f20dd
@ -37,6 +37,8 @@ REQUIRED READING:
|
|||||||
|
|
||||||
- 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
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pymongo import ASCENDING, DESCENDING
|
from pymongo import ASCENDING, DESCENDING
|
||||||
@ -51,7 +53,7 @@ ACTIVE_INDEXES = {}
|
|||||||
# ------------------
|
# ------------------
|
||||||
|
|
||||||
MEDIAENTRY_INDEXES = {
|
MEDIAENTRY_INDEXES = {
|
||||||
'mediaentry_uploader_slug_unique': {
|
'uploader_slug_unique': {
|
||||||
# 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}/
|
||||||
@ -59,12 +61,12 @@ MEDIAENTRY_INDEXES = {
|
|||||||
('slug', ASCENDING)],
|
('slug', ASCENDING)],
|
||||||
'unique': True},
|
'unique': True},
|
||||||
|
|
||||||
'mediaentry_created': {
|
'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.
|
||||||
'index': [('created', DESCENDING)]},
|
'index': [('created', DESCENDING)]},
|
||||||
|
|
||||||
'mediaentry_uploader_created': {
|
'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.
|
||||||
'index': [('uploader', ASCENDING),
|
'index': [('uploader', ASCENDING),
|
||||||
@ -78,12 +80,12 @@ ACTIVE_INDEXES['media_entries'] = MEDIAENTRY_INDEXES
|
|||||||
# ------------
|
# ------------
|
||||||
|
|
||||||
USER_INDEXES = {
|
USER_INDEXES = {
|
||||||
'user_username_unique': {
|
'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 :)
|
||||||
'index': 'username',
|
'index': 'username',
|
||||||
'unique': True},
|
'unique': True},
|
||||||
'user_created': {
|
'created': {
|
||||||
# All most recently created users
|
# All most recently created users
|
||||||
'index': 'created'}}
|
'index': 'created'}}
|
||||||
|
|
||||||
@ -95,4 +97,8 @@ ACTIVE_INDEXES['users'] = USER_INDEXES
|
|||||||
# Deprecated indexes
|
# Deprecated indexes
|
||||||
####################
|
####################
|
||||||
|
|
||||||
|
# @@: Do we really need to keep the index form if we're removing by
|
||||||
|
# key name? I guess it's helpful to keep the record...
|
||||||
|
|
||||||
|
|
||||||
DEPRECATED_INDEXES = {}
|
DEPRECATED_INDEXES = {}
|
||||||
|
@ -108,11 +108,6 @@ class MediaEntry(Document):
|
|||||||
|
|
||||||
migration_handler = migrations.MediaEntryMigration
|
migration_handler = migrations.MediaEntryMigration
|
||||||
|
|
||||||
indexes = [
|
|
||||||
# Referene uniqueness of slugs by uploader
|
|
||||||
{'fields': ['uploader', 'slug'],
|
|
||||||
'unique': True}]
|
|
||||||
|
|
||||||
def main_mediafile(self):
|
def main_mediafile(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user