listVersions

Definition

Lists database versions matching criteria. Wrapper for listVersions

Syntax

 db.listVersions([limit]|[startDate,endDate,limit,sortDirection])

The command accepts the following fields:

FieldTypeoptionalityDescription
startDateISODateoptionalstarting datetime for the date range. If ommited, set to 24 hours ago
endDateISODateoptionalending datetime for the date range. If ommited, set the current time
limitnumberoptionalNumber of versions to return. Defaults to 10
sortDirectionnumberoptionalcontrols sorting of versions. If 1, sorted in ascending date, if -1 sorted in descending date order

If a single numeric argument (N) is provided, then the command will return the last N versions.

Example

ProvenDB v7754 (current)> db.listVersions()
{
        "ok" : 1,
        "versions" : [
                {
                        "version" : NumberLong(7754),
                        "status" : "Ended",
                        "effectiveDate" : ISODate("2019-06-11T06:29:07Z")
                },
                {
                        "version" : NumberLong(7753),
                        "status" : "Ended",
                        "effectiveDate" : ISODate("2019-06-06T04:15:49Z")
                },
                {
                        "version" : NumberLong(7752),
                        "status" : "Ended",
                        "effectiveDate" : ISODate("2019-06-06T04:14:03Z")
                }...
   ]
}

ProvenDB v4816 (current)> db.listVersions(3)
{
        "ok" : 1,
        "versions" : [
                {
                        "version" : NumberLong(4816),
                        "status" : "Ended",
                        "effectiveDate" : ISODate("2019-06-12T07:07:43Z")
                },
                {
                        "version" : NumberLong(4815),
                        "status" : "Ended",
                        "effectiveDate" : ISODate("2019-06-12T07:07:42Z")
                },
                {
                        "version" : NumberLong(4814),
                        "status" : "Ended",
                        "effectiveDate" : ISODate("2019-06-11T07:43:33Z")
                }
        ]
}

See Also

listVersions