-
-
Notifications
You must be signed in to change notification settings - Fork 228
Open
Description
Bug Report
| Q | A |
|---|---|
| Version | 2.2.0 |
Summary
I have GridFS document with #[File] attribute. It stores data in two collections xxx.files and xxx.chunks. MongoDBPurger drops only xxx.files but keeps xxx.chunks.
Current behavior
MongoDBPurger drops only xxx.files collection for GridFS documents.
Expected behavior
MongoDBPurger drops both xxx.files and xxx.chunks collections for GridFS documents.
How to reproduce
Add a document:
use Doctrine\ODM\MongoDB\Mapping\Annotations\File;
use Doctrine\ODM\MongoDB\Mapping\Annotations\Id;
#[File(bucketName: 'report')]
class Report
{
#[Id]
private string $id;
#[File\Filename]
private string $name;
public function getId(): string
{
return $this->id;
}
public function getName(): string
{
return $this->name;
}
}Create the schema:
bin/console doctrine:mongodb:schema:createAfter that you will see 2 collections in your db: report.files and report.chunks.
Run MongoDBPurger:
#[AsCommand('debug')]
class DebugCommand extends Command
{
public function __construct(private MongoDBPurger $purger)
{
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->purger->purge();
return Command::SUCCESS;
}
}As MongoDBPurger calls $schemaManager->createCollections() you will get an error:
/var/www $ bin/console debug
In CreateCollection.php line 257:
Collection mydb.report.chunks already exists. Metadata
Metadata
Assignees
Labels
No labels