parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Unable to query rows with array keys which equals empty array []

Open hybeats opened this issue 5 years ago • 13 comments

Issue Description

Couldn't find a way to query rows with array keys equal to empty array. For example: I have class 'Shelf' with key 'books' type of Array I have 2 rows. First row has books = [ { Pointer }, { Pointer } ]. Second row has books = []

How do i query second row?

hybeats avatar Mar 16 '20 10:03 hybeats

Hi! @hybeats . My workaround to make these types of queries is the following:

  const pipeline = [{ match: { books: { $eq: [] } } }];
  const shelfs = await query.aggregate(pipeline);
  return shelfs;

@davimacedo Maybe it will be good to query with equalTo: [] method.

santiagosemhan avatar Mar 19 '20 21:03 santiagosemhan

@dplewis Is this an issue with Parse JS SDK?

santiagosemhan avatar Mar 20 '20 12:03 santiagosemhan

@hybeats Sorry for the late reply. Can you provide sample code or write up a failing test?

dplewis avatar Mar 22 '20 19:03 dplewis

@dplewis I tried this code, without a successful response.

  const query = new Parse.Query('Shelf');
  query.equalsTo('books', []);
  const shelfs = await query.find();
  return shelfs;

santiagosemhan avatar Mar 23 '20 13:03 santiagosemhan

Could you please help me anyone How to check array empty and array contain some value and undefined ? in parse android ArrayList<String> list = new ArrayList<String>(); list.add("CP"); query.whereDoesNotExist("businessPlatform"); query.whereContainedIn("businessPlatform", list); This is not working How should i process this type of condition AND Operation is available in parse query ?

VenkateshNani512 avatar Apr 15 '20 06:04 VenkateshNani512

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 30 '20 07:05 stale[bot]

Any news about this? The aggregate workaround doesn't work for me because I put this query in an OR query.

gcostaapps avatar Sep 29 '21 01:09 gcostaapps

@gcostaapps If you experience this issue with the latest version of Parse Server could you please open a new issue so we can investigate this?

mtrezza avatar Sep 29 '21 10:09 mtrezza

Still happens, version 5.3.3 @santiagosemhan example is accurate, for array field with [] value

zivchen avatar Dec 15 '22 12:12 zivchen

Could you open a PR against alpha with a failing test that demonstrates the issue? That would help us to address it.

mtrezza avatar Dec 17 '22 12:12 mtrezza

Thanks for opening this issue!

  • ❌ Please edit your post and use the provided template when creating a new issue. This helps everyone to understand your post better and asks for essential information to quicker review the issue.

Is it fixed with the latest versions?

tiavina-mika avatar Dec 04 '24 08:12 tiavina-mika

We don't know. If someone could open a PR with a failing test, that would help us.

mtrezza avatar Dec 08 '24 12:12 mtrezza