diff --git a/bigchaindb/backend/localmongodb/query.py b/bigchaindb/backend/localmongodb/query.py index 557dfa1c..f99f3815 100644 --- a/bigchaindb/backend/localmongodb/query.py +++ b/bigchaindb/backend/localmongodb/query.py @@ -43,10 +43,10 @@ def store_metadata(conn, metadata): @register_query(LocalMongoDBConnection) -def get_metadata(conn, txn_ids): +def get_metadata(conn, transaction_ids): return conn.run( conn.collection('metadata') - .find({'id': {'$in': txn_ids}}, + .find({'id': {'$in': transaction_ids}}, projection={'_id': False})) diff --git a/bigchaindb/backend/localmongodb/schema.py b/bigchaindb/backend/localmongodb/schema.py index b42b1bb2..2d916856 100644 --- a/bigchaindb/backend/localmongodb/schema.py +++ b/bigchaindb/backend/localmongodb/schema.py @@ -94,7 +94,7 @@ def create_metadata_secondary_index(conn, dbname): # the id is the txid of the transaction where metadata was defined conn.conn[dbname]['metadata'].create_index('id', - name='txn_id', + name='transaction_id', unique=True) # full text search index diff --git a/bigchaindb/backend/query.py b/bigchaindb/backend/query.py index f8ea879f..766d6668 100644 --- a/bigchaindb/backend/query.py +++ b/bigchaindb/backend/query.py @@ -35,10 +35,10 @@ def store_asset(connection, asset): @singledispatch def store_metadata(connection, metadata): - """Write an asset to the asset table. + """Write metadata to the metadata table. Args: - asset (dict): the asset. + metadata (dict): transaction metadata. Returns: The result of the operation. @@ -345,11 +345,11 @@ def get_assets(connection, asset_ids): @singledispatch -def get_metadata(connection, txn_ids): +def get_metadata(connection, transaction_ids): """Get a list of metadata from the metadata table. Args: - txn_ids (list): a list of ids for the metadata to be retrieved from + transaction_ids (list): a list of ids for the metadata to be retrieved from the database. Returns: diff --git a/bigchaindb/tendermint/lib.py b/bigchaindb/tendermint/lib.py index 6247f96e..37fb9d6e 100644 --- a/bigchaindb/tendermint/lib.py +++ b/bigchaindb/tendermint/lib.py @@ -52,10 +52,10 @@ class BigchainDB(Bigchain): backend.query.store_asset(self.connection, asset) metadata = transaction.pop('metadata') - txn_metadata = {'id': transaction['id'], - 'metadata': metadata} + transaction_metadata = {'id': transaction['id'], + 'metadata': metadata} - backend.query.store_metadata(self.connection, [txn_metadata]) + backend.query.store_metadata(self.connection, [transaction_metadata]) return backend.query.store_transaction(self.connection, transaction)