SDK for JS setGroupBy not having expected effect on getObjectCount. Returns incorrect count of objects

The following code returns an object count of 19, where the number of objects that are actually fetched is 18. From my troubleshooting I’ve found that with or without setGroupBy, the result of getObjectCount is 19. Could this be a problem with how setGroupBy works or how I’m using it?

SDK for JS Example:

var whereClause = "(ownerId = 'CF85D4A4-2A77-4F46-99AA-E6BD3A70FD58' OR 'CF85D4A4-2A77-4F46-99AA-E6BD3A70FD58' = permissions.edit.objectId OR 'CF85D4A4-2A77-4F46-99AA-E6BD3A70FD58' = permissions.view.objectId) AND parentDirectory IS null OR (permissions.view.objectId = 'CF85D4A4-2A77-4F46-99AA-E6BD3A70FD58' AND (objectId NOT IN (DirectoryObject[parentDirectory.permissions.view.objectId = 'CF85D4A4-2A77-4F46-99AA-E6BD3A70FD58'].objectId)) AND ownerId != 'CF85D4A4-2A77-4F46-99AA-E6BD3A70FD58')"


var queryBuilder = Backendless.DataQueryBuilder.create()
  .setWhereClause( whereClause )
  .setGroupBy('objectId');
Backendless.Data.of( "DirectoryObject" ).getObjectCount(queryBuilder)
  .then( function( count ) {
    console.log(count) // prints "19"
  })
  .catch( function( error ) {
    console.log(error)
  });


var queryBuilder2 = Backendless.DataQueryBuilder.create()
  .setWhereClause( whereClause )
  .setGroupBy('objectId')
  .setPageSize(100);
Backendless.Data.of("DirectoryObject").find(queryBuilder2)
  .then(function(result) {
    console.log(result.length) // prints "18"
  }).catch( function( error ) {
    console.log(error)
  });

The count should be 18. Using the rest api I get a count of 18, is this a bug on the backendless side?

Rest API Example:
/data/DirectoryObject/count?where=(ownerId%20%3D%20’CF85D4A4-2A77-4F46-99AA-E6BD3A70FD58’%20OR%20’CF85D4A4-2A77-4F46-99AA-E6BD3A70FD58’%20%3D%20permissions.edit.objectId%20OR%20’CF85D4A4-2A77-4F46-99AA-E6BD3A70FD58’%20%3D%20permissions.view.objectId)%20AND%20parentDirectory%20IS%20null%20OR%20(permissions.view.objectId%20%3D%20’CF85D4A4-2A77-4F46-99AA-E6BD3A70FD58’%20AND%20(objectId%20NOT%20IN%20(DirectoryObject%5BparentDirectory.permissions.view.objectId%20%3D%20’CF85D4A4-2A77-4F46-99AA-E6BD3A70FD58’%5D.objectId))%20AND%20ownerId%20!%3D%20’CF85D4A4-2A77-4F46-99AA-E6BD3A70FD58’)&groupBy=%60objectId%60

Hello @Tyler_Jacklin,

I was able to reproduce your issue. An internal ticket has been created in order to fix this (BKNDLSS-31259).
We will notify you here once it is fixed.

Regards,
Stanislaw

Hello @Tyler_Jacklin

We’ve just updated cloud servers with a fix for the issue you described above. Could you kindly let us know whether fix works for you well?

Regards,
Inna