Skip to content

cloud code query.each() useMasterKey:true #3401

Closed
@BarryWood34

Description

@BarryWood34

I'm using query.each() in my cloud code and am struggling to make it work with useMasterKey:true. error returned is "Error=Permission denied for action find on class ..."

Logging suggests my problem lies in the query.each() function

What is the correct syntax for using useMasterKey:true with query.each?

I've got other examples working such as ...

 object.save(null,{useMasterKey:true})

and

query.find({useMasterKey:true,success:...

Here's the outline of the code with some of the detail commented out.

thanks in advance...

query3.each(
                                                        
    function(object){
    ...
    object.save(null,{useMasterKey:true})
    },
    {
    success: function() {
    ...
    response.success("OK");
    },
    error: function(error) {
    ...
    response.error("Failed");
    }
    }, {useMasterKey: true});
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions