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

MongoDB 4.4 compatibility problems #642

Open
oduranW opened this issue Sep 1, 2021 · 2 comments
Open

MongoDB 4.4 compatibility problems #642

oduranW opened this issue Sep 1, 2021 · 2 comments
Labels

Comments

@oduranW
Copy link

oduranW commented Sep 1, 2021

With MongoDB 4.4 Path Collision Restrictions were introduced (https://docs.mongodb.com/manual/release-notes/4.4-compatibility/#path-collision-restrictions), as a result some queries do not work using this connector anymore.

Steps to reproduce

We are running a nodejs app over loopback3 that is using this connector to connect to a MongoDB 4.2 atlas cluster.

Package versions:

"loopback": "3.28.0",
"loopback-connector-mongodb": "5.5.0",

Considering dataModel as an object with:

data : {
     id: 1,
     total: {
        day: [1,2,3],
        month: [4,5,6],
        year: [7,8,9]
     }
}

The following query will result in a path collision error:
data = await this.dataModel.findById({ id: this.Id, filter: { fields: ['total', 'total.month'] } });

And if you update the syntax to follow the MongoDB 4.4 requirements, the query returns an empty object:
data = await this.dataModel.findById({ id: Id, filter: { fields: ['total.month'] } });

Current Behavior

When using the syntax that MongoDB needs in version 4.4 the response comes with no data, and if you try to use the old syntax mongoDB will reject the query with a path collision error.

Expected Behavior

This query should return data since when it is done directly to MongoDB without using the connector it works
data = await this.dataModel.findById({ id: this.Id, filter: { fields: ['total.month'] } });

data should store the object:
{total.month : [4,5,6]}

Additional information

I do not know if this is intended or the connector only supports MongoDB 4.2 or lower versions.

@oduranW oduranW added the bug label Sep 1, 2021
@stale
Copy link

stale bot commented Oct 31, 2021

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

@stale stale bot added the stale label Oct 31, 2021
@stale
Copy link

stale bot commented Nov 14, 2021

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

@stale stale bot closed this as completed Nov 14, 2021
@mrmodise mrmodise reopened this Nov 15, 2021
@stale stale bot removed the stale label Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants