Exclude doesn't work for child objects

I want to exclude some fields from results such as user email. But exclude method is ignored in child objects. I tried:

query.exclude("someField");
query.exclude("user.email", ..Other fields);

I also tried

query.exclude("someField","user.email");

Exclude works fine for main object but for child object,its ignored. How to solve this?

I tried this in Parse-Server 4.3.0.
In cloud code node environment

Analogous to your previous question about select, the exclude option also translates into projection for excluding fields.

MongoDB allows projection also for child elements. However, that doesn’t mean that Parse Server also supports this (yet). If child element projection does not work for you, you can open an issue in the Parse Server repo. If you want to go further you could open a PR and start by writing a failing test case for this.

1 Like

I can try to open a PR. But since I’m not a professinal there is a 99½ of chance that I can’t make it. but will try.

At the worst case scenerio, I will convert parse objects to json and delete those fields by manually.

Edit: I created an issue https://github.com/parse-community/parse-server/issues/7030