Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odm:schema:drop command does not drop search indexes #2684

Closed
pkowalski700lm opened this issue Oct 2, 2024 · 1 comment
Closed

odm:schema:drop command does not drop search indexes #2684

pkowalski700lm opened this issue Oct 2, 2024 · 1 comment

Comments

@pkowalski700lm
Copy link

pkowalski700lm commented Oct 2, 2024

Bug Report

Q A
BC Break yes
Version 2.9.0

Summary

odm:schema:drop does not drop search indexes.

Current behavior

After running odm:schema:create while having mapped document with search index defined & mapped, odm:schema:drop does not drop search index. While trying to drop it it outputs error: Cannot use object of type stdClass as array.

It succesfuly drops normal indexes, collections and databases after that.

How to reproduce

  1. Add some search index to mapped document
  2. run odm:schema:create
  3. run odm:schema:drop

Expected behavior

Search index should be succesfully dropped.

@GromNaN
Copy link
Member

GromNaN commented Oct 14, 2024

Testing this with this document class, I reproduce the error. I'm not able to get the stack trace of the error using -vvv, that makes debugging more difficult.

namespace App\Document;

use Doctrine\ODM\MongoDB\Mapping\Annotations\{Document, Field, Id, SearchIndex};
use MongoDB\BSON\ObjectId;

#[Document, SearchIndex(dynamic: true)]
class Article
{
    #[Id] public ObjectId $id;
    #[Field] public string $title;
}

I noted an other similar issue when none of dynamic or fields parameter is set and running the creation command doctrine:mongodb:schema:create:

BSON field 'createSearchIndexes.indexes.definition' is the wrong type 'array', expected type 'object'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants