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

Embedded document index with partialFilterExpression is wrong #2214

Open
Steveb-p opened this issue Jul 25, 2020 · 2 comments
Open

Embedded document index with partialFilterExpression is wrong #2214

Steveb-p opened this issue Jul 25, 2020 · 2 comments
Assignees
Labels
Projects

Comments

@Steveb-p
Copy link
Contributor

Bug Report

Q A
BC Break no
Version 2.1.2

Summary

Embedded documents when creating indexes receive them with wrong partialFilterExpression, as if they were not embedded.

Current behavior

For a document class:

/**
 * @ODM\EmbeddedDocument(indexes={
 *      @ODM\Index(
 *          background=true,
 *          name="statistic_aggregate_transaction_state_idx",
 *          keys={
 *              "last_changed"="asc",
 *              "transaction_state"="asc",
 *          },
 *          partialFilterExpression={
 *              "transaction_state"=StatisticAggregateState::TRANSACTION_STATE_CHANGESET_NEW,
 *          },
 *      ),
 * })
 */
class StatisticAggregateState
{
    private const TRANSACTION_STATE_CHANGESET_APPLIED = 'applied';
    public const TRANSACTION_STATE_CHANGESET_NEW = 'new';
    ...
}

...creates an index with following specification:

db.collection.createIndex(
    {
        "statistic_aggregate_states.transaction_state": 1,
        "statistic_aggregate_states.last_changed": 1
    },
    {
        name: "statistic_aggregate_states_statistic_aggregate_transaction_state_idx",
        background: true,
        partialFilterExpression: {
            transaction_state: "new"
        }
    }
)

Expected behavior

Created index should actually be:

db.collection.createIndex(
    {
        "statistic_aggregate_states.transaction_state": 1,
        "statistic_aggregate_states.last_changed": 1
    },
    {
        name: "statistic_aggregate_states_statistic_aggregate_transaction_state_idx",
        background: true,
        partialFilterExpression: {
            "statistic_aggregate_states.transaction_state": "new"
        }
    }
)
@stale
Copy link

stale bot commented Aug 25, 2020

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale Issues that have not seen any activity in 30 days label Aug 25, 2020
@malarzm
Copy link
Member

malarzm commented Sep 1, 2020

Given partial indexes were introduced in 1.1 (#1303) this needs to be fixed in 1.3.x branch and then merged up. Gonna schedule it so the report won't fall through the cracks

@stale stale bot removed the Stale Issues that have not seen any activity in 30 days label Sep 1, 2020
@malarzm malarzm added the Bug label Sep 1, 2020
@malarzm malarzm added this to the 1.3.8 milestone Sep 1, 2020
@alcaeus alcaeus modified the milestones: 1.3.8, 2.1.3 Dec 16, 2020
@alcaeus alcaeus self-assigned this Dec 16, 2020
@alcaeus alcaeus added this to 2.1 (bug fixes only) in Roadmap Dec 16, 2020
@malarzm malarzm modified the milestones: 2.1.3, 2.1.4 Dec 20, 2020
@alcaeus alcaeus removed this from the 2.1.4 milestone Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Roadmap
2.1 (unsupported)
Development

No branches or pull requests

3 participants