need empty arry return in event handler

I need an empty array [] in event handler output
Backendless.ServerCode.Persistence.beforeFind(‘userCoupon’, function(req) {
var foo = [];
return foo;

});
But this return error
{
“code”: 20014,
“message”: “PrematureResult in your event handler has incompatible type ‘[Ljava.lang.Object;’, whereas return type is ‘java.util.Collection’.”
}
Please help me.

Looks like you’re trying to return a premature result from your before handler. Try returning an object {“short”: true} from the handler according to the docs and see what you’ll get in response on the client. Probably you’ll get an empty array as expected, but if not - please post what you receive instead.

I done this .
Backendless.ServerCode.Persistence.beforeFind(‘userCoupon’, function(req) {
return { short: true }
});
Got Same error
{
“code”: 20014,
“message”: “PrematureResult in your event handler has incompatible type ‘java.util.HashMap’, whereas return type is ‘java.util.Collection’.”
}

Hi Thomas

We’ve found the problem and our developer is working on it, we will notify you here about result asap

Regards, Vlad

Thank you for checking. I’ve created an internal task BKNDLSS-16338 to investigate this issue.

Hi Thomas,

Issue has been fixed, code from your description now returns an empty array as expected.

Regards,
Anton