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

Query on pointer losing _p_ prefix #1875

Closed
steven-supersolid opened this issue May 23, 2016 · 3 comments
Closed

Query on pointer losing _p_ prefix #1875

steven-supersolid opened this issue May 23, 2016 · 3 comments

Comments

@steven-supersolid
Copy link
Contributor

parse-server 2.2.7, heroku, mlab

Very rarely a query on a pointer is losing the _p on the property name. E.g. we have a class Inventory with pointer to _User named user. We have a $in query on specific _User id's. In the mongo logs the query looks like the following when working:

2016-05-23T01:55:12.789-0700 I QUERY [conn764619] query myApp.Inventory query: { _p_user: { $in: [ "_User$abc", "_User$123" ] } } planSummary: IXSCAN { _p_user: 1, _id: 1, _created_at: -1 }...

When not working:

2016-05-23T02:44:47.280-0700 I QUERY [conn764631] query myApp.Inventory query: { user: { $in: [ "_User$abc", "_User$123" ] } } planSummary: COLLSCAN...

This is causing a full collection scan (as well as not finding required results) because that property is not present and not indexed on any of the documents.

I'm adding some logging in MongoTransform.transformWhere but wondering if this is related to #1691

@drew-gross
Copy link
Contributor

This is almost certainly related to #1691. My guess is that loadSchema wasn't called in the appropriate place. I'm working on some stuff that will fix the issue if that is the cause.

@steven-supersolid
Copy link
Contributor Author

I finally got some logging back from this from the following code in MongoTransform.transformWhere:

    if (restKey === 'user' && out.key !== '_p_user') {
      log.info('MongoTransform.transformWhere', 'className', className, 'restKey', restKey, 'out', out, 'restWhere', restWhere, 'schema.data', schema.data);
    }

Result is:
May 27 14:32:30 myapp app/web.4: info: MongoTransform.transformWhere className Inventory restKey user out { key: 'user', May 27 14:32:30 myapp app/web.4: value: { '$in': [ '_User$abc', '_User$123' ] } } restWhere { user: { '$in': [ [Object], [Object] ] } } schema.data

So as suspected, the schema wasn't loaded.

@drew-gross
Copy link
Contributor

Should be fixed by 2.2.11

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