Esempio n. 1
0
    def ensure_indexes(self):
        """
        Ensure that all appropriate indexes are created that are needed by this modulestore, or raise
        an exception if unable to.

        This method is intended for use by tests and administrative commands, and not
        to be run during server startup.
        """
        create_collection_index(self.course_index,
                                [('org', pymongo.ASCENDING),
                                 ('course', pymongo.ASCENDING),
                                 ('run', pymongo.ASCENDING)],
                                unique=True,
                                background=True)
Esempio n. 2
0
    def ensure_indexes(self):
        """
        Ensure that all appropriate indexes are created that are needed by this modulestore, or raise
        an exception if unable to.

        This method is intended for use by tests and administrative commands, and not
        to be run during server startup.
        """
        create_collection_index(
            self.course_index,
            [("org", pymongo.ASCENDING), ("course", pymongo.ASCENDING), ("run", pymongo.ASCENDING)],
            unique=True,
            background=True,
        )
Esempio n. 3
0
 def ensure_indexes(self):
     # Index needed thru 'category' by `_get_all_content_for_course` and others. That query also takes a sort
     # which can be `uploadDate`, `displayname`,
     # TODO: uncomment this line once this index in prod is cleaned up. See OPS-2863 for tracking clean up.
     #  create_collection_index(
     #      self.fs_files,
     #      [
     #          ('_id.tag', pymongo.ASCENDING),
     #          ('_id.org', pymongo.ASCENDING),
     #          ('_id.course', pymongo.ASCENDING),
     #          ('_id.category', pymongo.ASCENDING)
     #      ],
     #      sparse=True,
     #      background=True
     #  )
     create_collection_index(self.fs_files,
                             [('content_son.org', pymongo.ASCENDING),
                              ('content_son.course', pymongo.ASCENDING),
                              ('uploadDate', pymongo.DESCENDING)],
                             sparse=True,
                             background=True)
     create_collection_index(self.fs_files,
                             [('_id.org', pymongo.ASCENDING),
                              ('_id.course', pymongo.ASCENDING),
                              ('_id.name', pymongo.ASCENDING)],
                             sparse=True,
                             background=True)
     create_collection_index(self.fs_files,
                             [('content_son.org', pymongo.ASCENDING),
                              ('content_son.course', pymongo.ASCENDING),
                              ('content_son.name', pymongo.ASCENDING)],
                             sparse=True,
                             background=True)
     create_collection_index(self.fs_files,
                             [('_id.org', pymongo.ASCENDING),
                              ('_id.course', pymongo.ASCENDING),
                              ('uploadDate', pymongo.ASCENDING)],
                             sparse=True,
                             background=True)
     create_collection_index(self.fs_files,
                             [('_id.org', pymongo.ASCENDING),
                              ('_id.course', pymongo.ASCENDING),
                              ('displayname', pymongo.ASCENDING)],
                             sparse=True,
                             background=True)
     create_collection_index(self.fs_files,
                             [('content_son.org', pymongo.ASCENDING),
                              ('content_son.course', pymongo.ASCENDING),
                              ('uploadDate', pymongo.ASCENDING)],
                             sparse=True,
                             background=True)
     create_collection_index(self.fs_files,
                             [('content_son.org', pymongo.ASCENDING),
                              ('content_son.course', pymongo.ASCENDING),
                              ('displayname', pymongo.ASCENDING)],
                             sparse=True,
                             background=True)
Esempio n. 4
0
 def ensure_indexes(self):
     # Index needed thru 'category' by `_get_all_content_for_course` and others. That query also takes a sort
     # which can be `uploadDate`, `display_name`,
     create_collection_index(self.fs_files,
                             [('_id.tag', pymongo.ASCENDING),
                              ('_id.org', pymongo.ASCENDING),
                              ('_id.course', pymongo.ASCENDING),
                              ('_id.category', pymongo.ASCENDING)],
                             sparse=True,
                             background=True)
     create_collection_index(self.fs_files,
                             [('content_son.org', pymongo.ASCENDING),
                              ('content_son.course', pymongo.ASCENDING),
                              ('uploadDate', pymongo.DESCENDING)],
                             sparse=True,
                             background=True)
     create_collection_index(self.fs_files,
                             [('_id.org', pymongo.ASCENDING),
                              ('_id.course', pymongo.ASCENDING),
                              ('_id.name', pymongo.ASCENDING)],
                             sparse=True,
                             background=True)
     create_collection_index(self.fs_files,
                             [('content_son.org', pymongo.ASCENDING),
                              ('content_son.course', pymongo.ASCENDING),
                              ('content_son.name', pymongo.ASCENDING)],
                             sparse=True,
                             background=True)
     create_collection_index(self.fs_files,
                             [('_id.org', pymongo.ASCENDING),
                              ('_id.course', pymongo.ASCENDING),
                              ('uploadDate', pymongo.ASCENDING)],
                             sparse=True,
                             background=True)
     create_collection_index(self.fs_files,
                             [('_id.org', pymongo.ASCENDING),
                              ('_id.course', pymongo.ASCENDING),
                              ('display_name', pymongo.ASCENDING)],
                             sparse=True,
                             background=True)
     create_collection_index(self.fs_files,
                             [('content_son.org', pymongo.ASCENDING),
                              ('content_son.course', pymongo.ASCENDING),
                              ('uploadDate', pymongo.ASCENDING)],
                             sparse=True,
                             background=True)
     create_collection_index(self.fs_files,
                             [('content_son.org', pymongo.ASCENDING),
                              ('content_son.course', pymongo.ASCENDING),
                              ('display_name', pymongo.ASCENDING)],
                             sparse=True,
                             background=True)
Esempio n. 5
0
 def ensure_indexes(self):
     # Index needed thru 'category' by `_get_all_content_for_course` and others. That query also takes a sort
     # which can be `uploadDate`, `displayname`,
     # TODO: uncomment this line once this index in prod is cleaned up. See OPS-2863 for tracking clean up.
     #  create_collection_index(
         #  self.fs_files,
         #  [
             #  ('_id.tag', pymongo.ASCENDING),
             #  ('_id.org', pymongo.ASCENDING),
             #  ('_id.course', pymongo.ASCENDING),
             #  ('_id.category', pymongo.ASCENDING)
         #  ],
         #  sparse=True,
         #  background=True
     #  )
     create_collection_index(
         self.fs_files,
         [
             ('content_son.org', pymongo.ASCENDING),
             ('content_son.course', pymongo.ASCENDING),
             ('uploadDate', pymongo.DESCENDING)
         ],
         sparse=True,
         background=True
     )
     create_collection_index(
         self.fs_files,
         [
             ('_id.org', pymongo.ASCENDING),
             ('_id.course', pymongo.ASCENDING),
             ('_id.name', pymongo.ASCENDING)
         ],
         sparse=True,
         background=True
     )
     create_collection_index(
         self.fs_files,
         [
             ('content_son.org', pymongo.ASCENDING),
             ('content_son.course', pymongo.ASCENDING),
             ('content_son.name', pymongo.ASCENDING)
         ],
         sparse=True,
         background=True
     )
     create_collection_index(
         self.fs_files,
         [
             ('_id.org', pymongo.ASCENDING),
             ('_id.course', pymongo.ASCENDING),
             ('uploadDate', pymongo.ASCENDING)
         ],
         sparse=True,
         background=True
     )
     create_collection_index(
         self.fs_files,
         [
             ('_id.org', pymongo.ASCENDING),
             ('_id.course', pymongo.ASCENDING),
             ('displayname', pymongo.ASCENDING)
         ],
         sparse=True,
         background=True
     )
     create_collection_index(
         self.fs_files,
         [
             ('content_son.org', pymongo.ASCENDING),
             ('content_son.course', pymongo.ASCENDING),
             ('uploadDate', pymongo.ASCENDING)
         ],
         sparse=True,
         background=True
     )
     create_collection_index(
         self.fs_files,
         [
             ('content_son.org', pymongo.ASCENDING),
             ('content_son.course', pymongo.ASCENDING),
             ('displayname', pymongo.ASCENDING)
         ],
         sparse=True,
         background=True
     )
Esempio n. 6
0
 def ensure_indexes(self):
     # Index needed thru 'category' by `_get_all_content_for_course` and others. That query also takes a sort
     # which can be `uploadDate`, `display_name`,
     create_collection_index(
         self.fs_files,
         [
             ('_id.tag', pymongo.ASCENDING),
             ('_id.org', pymongo.ASCENDING),
             ('_id.course', pymongo.ASCENDING),
             ('_id.category', pymongo.ASCENDING)
         ],
         sparse=True,
         background=True
     )
     create_collection_index(
         self.fs_files,
         [
             ('content_son.org', pymongo.ASCENDING),
             ('content_son.course', pymongo.ASCENDING),
             ('uploadDate', pymongo.DESCENDING)
         ],
         sparse=True,
         background=True
     )
     create_collection_index(
         self.fs_files,
         [
             ('_id.org', pymongo.ASCENDING),
             ('_id.course', pymongo.ASCENDING),
             ('_id.name', pymongo.ASCENDING)
         ],
         sparse=True,
         background=True
     )
     create_collection_index(
         self.fs_files,
         [
             ('content_son.org', pymongo.ASCENDING),
             ('content_son.course', pymongo.ASCENDING),
             ('content_son.name', pymongo.ASCENDING)
         ],
         sparse=True,
         background=True
     )
     create_collection_index(
         self.fs_files,
         [
             ('_id.org', pymongo.ASCENDING),
             ('_id.course', pymongo.ASCENDING),
             ('uploadDate', pymongo.ASCENDING)
         ],
         sparse=True,
         background=True
     )
     create_collection_index(
         self.fs_files,
         [
             ('_id.org', pymongo.ASCENDING),
             ('_id.course', pymongo.ASCENDING),
             ('display_name', pymongo.ASCENDING)
         ],
         sparse=True,
         background=True
     )
     create_collection_index(
         self.fs_files,
         [
             ('content_son.org', pymongo.ASCENDING),
             ('content_son.course', pymongo.ASCENDING),
             ('uploadDate', pymongo.ASCENDING)
         ],
         sparse=True,
         background=True
     )
     create_collection_index(
         self.fs_files,
         [
             ('content_son.org', pymongo.ASCENDING),
             ('content_son.course', pymongo.ASCENDING),
             ('display_name', pymongo.ASCENDING)
         ],
         sparse=True,
         background=True
     )