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

Support for nested .select() calls #2737

Merged
merged 6 commits into from
Sep 24, 2016
Merged

Support for nested .select() calls #2737

merged 6 commits into from
Sep 24, 2016

Conversation

flovilmart
Copy link
Contributor

  • Handle keys property in RestQuery when it contains nesting.
  • Support multiple level of nesting and inclusion

Fixes #1567

@flovilmart
Copy link
Contributor Author

Fixes #2653

Updated to use native field select in mongo and postgres

@flovilmart flovilmart modified the milestone: 2.2.22 Sep 19, 2016
@facebook-github-bot
Copy link

@flovilmart updated the pull request - view changes

@Meovel
Copy link

Meovel commented Sep 19, 2016

Great job, I came up with the problem on Friday and this comes up on Monday, thanks for the work.

@flovilmart
Copy link
Contributor Author

@zenithanu glad to help! Once reviewed and merged, this will be available by pointing your parse-server to parseplatform/parse-server#latest

@oazya500
Copy link

is there any way to stop nested select future after update server . because all my queries will fail

and I will use this in future after update my apps

thanks

@flovilmart
Copy link
Contributor Author

@oazya500 what would fail in your app?

@oazya500
Copy link

oazya500 commented Sep 28, 2016

ParseQuery quere = ParseQuery.getQuery("MSGES");

    quere.selectKeys(["user", "CATOGREY"]);
    quere.include("CATOGREY");
    quere.include("userShare");

    quere.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> scoreList,
                         com.parse.ParseException e) {

            if (e != null) {
               String name = parseObject.has("user") ?
                parseObject.getParseObject("user").getString("name") : "U";
                 String catname = parseObject.has("CATOGREY") ? parseObject.getParseObject("CATOGREY").getString("name") : "";
       }
            }
        }
    });

}

my old apps like above . so if I update server all my old apps will not git name for user or CATOGREY

and I should do like this in new app
quere.selectKeys(["user", "CATOGREY", "user.name", "CATOGREY.name"]);

and I want to updat server becuse I have this error in my server

ParseError { code: 101, message: 'Object not found.' }

and server restart after this error

app restart every 10 minute at most

│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ watching │
├───────────────────┼────┼──────┼──────┼────────┼─────────┼────────┼─────┼────────────┼─────────
│ msegate │ 0 │ fork │ 5673 │ online │ 18 │ 2m │ 0% │ 133.0 MB │ disabled │

@flovilmart
Copy link
Contributor Author

The previous behavior is still valid with that PR. Because you call include(). The update you suggest would just return the name key of that object, and not the whole object.

@oazya500
Copy link

it Supposed to be valid but Unfortunately not valid . give it try and you see it not valid even with include()

@oazya500
Copy link

did you mean for update I should do like this

quere.selectKeys(["user", "CATOGREY", "user.name", "CATOGREY.name"]);
quere.include("CATOGREY.name");
quere.include("user.name");

@flovilmart
Copy link
Contributor Author

quere.selectKeys(["user", "CATOGREY", "user.name", "CATOGREY.name"]);
quere.include("CATOGREY");
quere.include("user");

@oazya500
Copy link

even with beforeFind not valid

Parse.Cloud.beforeFind('MSGES', (req) => {
let query = req.query;
query.select("user","user.name","CATOGREY","CATOGREY.name");
return query;
or
return Parse.Query.or(q, otherQuery);
});

@oazya500
Copy link

quere.selectKeys(["user", "CATOGREY", "user.name", "CATOGREY.name"]);
quere.include("CATOGREY");
quere.include("user");

that for future I was do that but parse-server not support it before 2.2.22

@oazya500
Copy link

any update how to stop nested select in new update

@flovilmart
Copy link
Contributor Author

You can't disable that feature and it's unlikely to be removed as It was a bug compared to parse.com

@oazya500
Copy link

oazya500 commented Oct 1, 2016

for other problem what I can do

the problem is

ParseError { code: 101, message: 'Object not found.' }

and server restart after this error

app restart every 10 minute at most

@flovilmart
Copy link
Contributor Author

@oazya500 your server should not restart when logging an error. Are you using pm2 and monitoring the logs?

@oazya500
Copy link

oazya500 commented Oct 1, 2016

@flovilmart all off this app using parse server and one off them restart 260 times in tow day
Image of a1

@janswist
Copy link

selectKeys are no longer supported? I get this:
Error generating response. TypeError: query.selectKeys is not a function at /app/cloud/main.js:13:8 at /app/node_modules/parse-server/lib/Routers/FunctionsRouter.js:198:11 at new Promise (<anonymous>) at handleCloudFunction (/app/node_modules/parse-server/lib/Routers/FunctionsRouter.js:166:16) at /app/node_modules/parse-server/lib/PromiseRouter.js:253:7 at Layer.handle [as handle_request] (/app/node_modules/parse-server/node_modules/express/lib/router/layer.js:95:5) at next (/app/node_modules/parse-server/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/app/node_modules/parse-server/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/app/node_modules/parse-server/node_modules/express/lib/router/layer.js:95:5) at /app/node_modules/parse-server/node_modules/express/lib/router/index.js:281:22

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

Successfully merging this pull request may close these issues.

6 participants