Skip to content

beforeSubscribe doesnt change incoming query #6866

Closed
@maxiqsoft

Description

@maxiqsoft

Issue Description

Hi, Im trying to change the incoming query subscription with Parse.Cloud.beforeSubscribe but im still getting every column at the client. Ive tried changing the subscription query with query.equalTo too but it doesnt have any effect.
I did it the same way as here: beforeFind
The intention is that some parameter needed for the right subscription shouldnt be displayed in the source code.

Thats my Cloud code:

Parse.Cloud.beforeSubscribe( 'Chat', ( request ) => {
	if ( !request.user ) {
        throw "Please login before you attempt to connect.";
    }	
	var query = request.query;
        query.select( 'message', 'username' );
	return query;
});

Thats my Client code:

var chat = new Parse.Query( 'Chat' );
chat.subscribe().then(subscription=>{
       subscription.on( 'open', function(){
             console.log( 'Subscription to Chat opened...' );
       });
});

Environment

Server

  • Parse Server version: 4.3.0
  • Operating system: CentOS 8
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 4.0.19
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): JavaScript
  • SDK version: 2.15

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions