(self, db_uri, db_name, collection_name)
return self.get_cache()[db_name][collection_name]
Adds a collections index entries to the cache if not present
Adds a collections index entries to the cache if not present
Adds a collections index entries to the cache if not present
def _ensure_index_cache(self, db_uri, db_name, collection_name):
        """Adds a collections index entries to the cache if not present"""
        if not self._check_indexes or db_uri is None:
            return {'indexes': None}
        if db_name not in self.get_cache():
            self._internal_map[db_name] = {}
        if collection_name not in self._internal_map[db_name]:
            indexes = []
            try:
                if self._index_cache_connection is None:
                    self._index_cache_connection = pymongo.MongoClient(db_uri,
                                                                       document_class=OrderedDict,
                                                                       read_preference=pymongo.ReadPreference.PRIMARY_PREFERRED)

                db = self._index_cache_connection[db_name]
                indexes = db[collection_name].index_information()
            except:
                warning = 'Warning: unable to connect to ' + db_uri + "\n"
            else:
                internal_map_entry = {'indexes': indexes}
                self.get_cache()[db_name][collection_name] = internal_map_entry
        return self.get_cache()[db_name][collection_name]
def _ensure_index_cache ( self , db_uri , db_name , collection_name ) : if not self . _check_indexes or db_uri is None : return { 'indexes' : None } if db_name not in self . get_cache ( ) : self . _internal_map [ db_name ] = { } if collection_name not in self . _internal_map [ db_name ] : indexes = [ ] try : if self . _index_cache_connection is None : self . _index_cache_connection = pymongo . MongoClient ( db_uri , document_class = OrderedDict , read_preference = pymongo . ReadPreference . PRIMARY_PREFERRED ) db = self . _index_cache_connection [ db_name ] indexes = db [ collection_name ] . index_information ( ) except : warning = 'Warning: unable to connect to ' + db_uri + "\n" else : internal_map_entry = { 'indexes' : indexes } self . get_cache ( ) [ db_name ] [ collection_name ] = internal_map_entry return self . get_cache ( ) [ db_name ] [ collection_name ]