Get-VEMDBCollection

Short Description

Returns backed-up MongoDB collections.

Applies to

Veeam Backup & Replication

Product Edition: Enterprise Plus, Veeam Universal License

Syntax

This cmdlet provides parameter sets that allow you to:

  • Get all collections in a particular database.

Get-VEMDBCollection [-Database] <VEMDBDatabase> [-Name <String[]>] [<CommonParameters>]

  • Get all collections in the restore point.

Get-VEMDBCollection [-Session] <VEMDBRestoreSession> [-Name <String[]>] [<CommonParameters>]

Detailed Description

This cmdlet returns an array of backed-up MongoDB collections. After you get the backed-up collections, you can use the New-VEMDBCollectionRestoreOptions cmdlet to specify the required restore options.

Parameters

Parameter

Description

Type

Required

Position

Accept Pipeline Input

Session

Specifies a restore session initiated to perform operations with MongoDB databases.

Accepts the VEMDBRestoreSession object. To get this object, run the Get-VEMDBRestoreSession cmdlet.

True

0

True (ByValue)

Database

Specifies the MongoDB database that the collections reside on.

Accepts the VEMDBDatabase object. To get this object, run the Get-VEMDBDatabase cmdlet.

True

0

True (ByValue)

Name

Specifies an array of names of MongoDB collections. The cmdlet will return an array of collections located on the restore point or the specified database.

String[]

False

Named

False

<CommonParameters>

This cmdlet supports Microsoft PowerShell common parameters. For more information on common parameters, see the About CommonParameters section of Microsoft Docs.

Output Object

The cmdlet returns the VEMDBCollection[] object that contains an array of backed-up MongoDB collections.

Examples

Get-VEMDBCollectionExample 1. Getting All MongoDB Collections Within Specified Restore Session

This example shows how to get an array of all MongoDB databases within the specified restore session.

$session = Get-VEMDBRestoreSession

$collections = Get-VEMDBCollection -Session $session[1]

Perform the following steps:

  1. Run the Get-VEMDBRestoreSession cmdlet. Save the result to the $session variable.

The cmdlet will return an array of active restore sessions. Note the ordinal number of the necessary restore session (in our example, it is the second restore session in the array).

  1. Run the Get-VEMDBCollection cmdlet. Set the $session variable as the Session parameter value and select the necessary restore session. Save the result to the $databases variable to be able to use it with other cmdlets.

Get-VEMDBCollectionExample 2. Getting MongoDB Databases With Specified Names

This example shows how to get an array of MongoDB databases with the specified names.

$session = Get-VEMDBRestoreSession

$dbnames = @("employees", "customers")

$databases = Get-VEMDBCollection -Session $session[1] -Name $dbnames

Perform the following steps:

  1. Run the Get-VEMDBRestoreSession cmdlet. Save the result to the $session variable.

The cmdlet will return an array of active restore sessions. Note the ordinal number of the necessary restore session. In our example, it is the second restore session in the array.

  1. Declare the $dbnames variable. Assign to this variable an array with the names of the necessary MongoDB databases.
  2. Run the Get-VEMDBDatabase cmdlet. Set the $session variable as the Session parameter value and specify the necessary restore session. Set the $dbnames variable as the Name parameter value. Save the result to the $databases variable to be able to use it with other cmdlets.

Related Commands

Page updated 7/12/2024

Page content applies to build 12.2.0.334