Merge "Replaces ensure_index for create_index"

This commit is contained in:
Jenkins 2015-06-24 06:56:22 +00:00 committed by Gerrit Code Review
commit 1ffc1c4664
2 changed files with 8 additions and 8 deletions

View File

@ -187,12 +187,12 @@ class Connection(pymongo_base.Connection):
'no_key': meter_id,
'timestamp': timestamp})
self.db.resource.ensure_index([
self.db.resource.create_index([
('user_id', pymongo.ASCENDING),
('project_id', pymongo.ASCENDING),
('source', pymongo.ASCENDING)], name='resource_idx')
self.db.meter.ensure_index([
self.db.meter.create_index([
('resource_id', pymongo.ASCENDING),
('user_id', pymongo.ASCENDING),
('project_id', pymongo.ASCENDING),
@ -200,7 +200,7 @@ class Connection(pymongo_base.Connection):
('timestamp', pymongo.ASCENDING),
('source', pymongo.ASCENDING)], name='meter_idx')
self.db.meter.ensure_index([('timestamp',
self.db.meter.create_index([('timestamp',
pymongo.DESCENDING)],
name='timestamp_idx')

View File

@ -430,7 +430,7 @@ class Connection(pymongo_base.Connection):
index={'keyPattern': {index_field: pymongo.ASCENDING},
'expireAfterSeconds': ttl})
coll.ensure_index([(index_field, pymongo.ASCENDING)],
coll.create_index([(index_field, pymongo.ASCENDING)],
expireAfterSeconds=ttl,
name=ttl_index_name)
@ -453,13 +453,13 @@ class Connection(pymongo_base.Connection):
background = dict(user_id=False, project_id=True)
for primary in ['user_id', 'project_id']:
name = 'resource_%sidx' % name_qualifier[primary]
self.db.resource.ensure_index([
self.db.resource.create_index([
(primary, pymongo.ASCENDING),
('source', pymongo.ASCENDING),
], name=name, background=background[primary])
name = 'meter_%sidx' % name_qualifier[primary]
self.db.meter.ensure_index([
self.db.meter.create_index([
('resource_id', pymongo.ASCENDING),
(primary, pymongo.ASCENDING),
('counter_name', pymongo.ASCENDING),
@ -467,11 +467,11 @@ class Connection(pymongo_base.Connection):
('source', pymongo.ASCENDING),
], name=name, background=background[primary])
self.db.resource.ensure_index([('last_sample_timestamp',
self.db.resource.create_index([('last_sample_timestamp',
pymongo.DESCENDING)],
name='last_sample_timestamp_idx',
sparse=True)
self.db.meter.ensure_index([('timestamp', pymongo.DESCENDING)],
self.db.meter.create_index([('timestamp', pymongo.DESCENDING)],
name='timestamp_idx')
# remove API v1 related table
self.db.user.drop()