Added secondary index for "id" in bigchain collection.

This commit is contained in:
kansi 2017-10-27 15:05:43 +05:30
parent ad6dd9a5af
commit ddfce61b79
1 changed files with 5 additions and 0 deletions

View File

@ -50,6 +50,11 @@ def drop_database(conn, dbname):
def create_bigchain_secondary_index(conn, dbname):
logger.info('Create `bigchain` secondary index.')
# secondary index on block id which is should be unique
conn.conn[dbname]['bigchain'].create_index('id',
name='block_id',
unique=True)
# to order blocks by timestamp
conn.conn[dbname]['bigchain'].create_index([('block.timestamp',
ASCENDING)],