listVersions
List versions in the database
Definition
listVersions returns an array of version information matching a date range filter.
The listVersions command has the following format:
{
"listVersions": {
"startDate": <ISODate>,
"endDate": <ISODate>,
"limit": <number>,
"sortDirection": <number>
}
}
The command accepts the following fields:
Field | Type | Mandatory |
---|---|---|
startDate | ISODate | no |
endDate | ISODate | no |
limit | number | no |
sortDirection | number | no |
Output
The returned document contains a array of the following fields:
Field | Type | Description |
---|---|---|
ok | number | The status of the command. |
versions | array | The list of versions. |
versions.version | number | The version number. |
versions.status | string | Status of the version |
versions.effectiveDate | ISODate | The effective date for the version. This is the date that all ProvenDB processing completed. |
Examples
Get the version in effect this time yesterday
// Create a ISODate for one day ago (24*60*60*1000 is milliseconds in 24 hours)
mongo>var yesterday = new Date(new Date() - 24 * 3600 * 1000);
mongo>db.runCommand({
... listVersions: { endDate: yesterday, limit: 1, sortDirection: -1 }
... });
{
"ok" : 1,
"versions" : [
{
"version" : NumberLong(5046),
"status" : "Ended",
"effectiveDate" : ISODate("2019-03-19T05:52:39Z")
}
]
}
Updated over 5 years ago
What’s Next