question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

orderBy don't return any results

See original GitHub issue

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

My query return expected results (but not ordered) without the orberBy and return an empty result with the orberBy.

try {
  const results = await firestore.get({
    collection: 'groups',
    where: [
      ['departureStation.id', '==', departureStationId],
      ['arrivalStation.id', '==', arrivalStationId],
      ['dateTime', '>=', startDate.toDate()],
      ['dateTime', '<=', endDate.toDate()],
    ],
    orderBy: ['dateTime', 'desc'],
  });
  console.log(results); // Return no result (results.empty === true)
} catch (err) {
  console.log(err);
}

But without, I have expected results:

try {
  const results = await firestore.get({
    collection: 'groups',
    where: [
      ['departureStation.id', '==', departureStationId],
      ['arrivalStation.id', '==', arrivalStationId],
      ['dateTime', '>=', startDate.toDate()],
      ['dateTime', '<=', endDate.toDate()],
    ],
    // orderBy: ['dateTime', 'desc'],
  });
  console.log(results); // Return expected results (results.empty === false)
} catch (err) {
  console.log(err);
}

What is the expected behavior?

Unless i’m mistaken, the orderBy should not affect the number of retrieved results but only their orders.

I do not know if there is a connection with #46.

Which versions of dependencies, and which browser are affected by this issue? Did this work in previous versions or setups?

{
    "firebase": "^4.8.2",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-redux": "^5.0.6",
    "react-redux-firebase": "^2.0.1",
    "redux": "^3.7.2",
    "redux-firestore": "^0.2.5",
}

All browsers seems to be affected.

Thanks a lot for your help 😃

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
prescottpruecommented, Jan 31, 2018

@QuentinBrosse v0.2.6 includes the fix that @danleavitt0 provided. Let me know if it doesn’t work as expected.

1reaction
QuentinBrossecommented, Jan 31, 2018

Thanks a lot, it works like a charm ! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does including an orderBy statement not return all records?
The returned resultset excludes records that do not have the requested field. True, but all documents should have an id field, so this...
Read more >
OrderBy on ISearchQuery does not return the results properly ...
Taking advantage of the OrderBy of ISearchQuery doesn't return the items properly sorted and in some cases doesn't return items at all. E.g:...
Read more >
SELECT - ORDER BY Clause (Transact-SQL) - Microsoft Learn
The order in which rows are returned in a result set are not guaranteed unless an ORDER BY clause is specified. Determine the...
Read more >
cursor.sort() — MongoDB Manual
When sorting on a field which contains duplicate values, documents containing those values may be returned in any order. If consistent sort order...
Read more >
ORDER BY clause - Amazon Redshift
Results are returned based on binary UTF-8 ordering. You can also specify the ... If no option is specified, data is sorted in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found