showMetadata

Enable or suppress the output of provendb document metadata

Definition

showMetadata will control the display of _provendb_metadata information document for find commands on user collections. ProvenDB metadata defines the version numbers for which a given document is valid, and contains the document hash value which is used to pin the document to the blockchain.

Syntax

The showMetadata command has the following form:

{
    "showMetadata" : <boolean>
}

The command accepts the following fields:

FieldTypeMandatoryDescription
showMetadatabooleanyesReturns the document metadata if true. Defaults to false.

📘

Note

showMetaData is global across all connections for a named user. When you set showMetaData it will affect all connections authenticated by the same username.

Output

The returned document contains the following fields:

FieldTypeDescription
oknumberThe status of the command.

Examples

The following example shows output with and without showMetaData set to true:

> db.mydoc.insert({hello:'world'});
WriteResult({ "nInserted" : 1 })

> db.mydoc.findOne();
{ "_id" : ObjectId("5c6f760e90199f347da03786"), "hello" : "world" }

> db.runCommand({showMetaData:true});
{ "ok" : 1 }

> db.mydoc.findOne();
{
	"_id" : ObjectId("5c6f760e90199f347da03786"),
	"_provendb_metadata" : {
		"_id" : ObjectId("5c6f760e90199f347da03786"),
		"_mongoId" : ObjectId("5c6f760e90199f347da03786"),
		"minVersion" : NumberLong(10092),
		"hash" : "36a379b3866e036c23c28c46cd8334c5fe604e2061350700647a37fe9bb7d69a",
		"maxVersion" : NumberLong("9223372036854775807")
	},
	"hello" : "world"
}

What’s Next