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.

orderByChild and equalTo breaks for an unknown reason

See original GitHub issue

Hello again 😃

The below example works for me (it returns goals where uid is my id), but it does not work for other users - for others it returns { "my_id": null } where my_id is 8ias7814o24j...

@connect((state) => ({
  goals: helpers.dataToJS(state.firebase, 'goals'),
}))
@firebaseConnect((props) => ([
  `/goals#orderByChild=uid&equalTo=${ props.uid }`,
]))

However, this hand made query returns the list of objects as expected.

this.props.firebase.ref('goals').orderByChild('uid').equalTo(this.props.uid).once('value').then(snapshot => {
      console.log('Here');
      console.log(snapshot.val());
    }),

So I suspect that somewhere must be a bug. Appreciate your help 😉

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DeividasKcommented, Jan 23, 2017

Repo: https://github.com/DeividasK/my-future-ai Project page: https://tgoals.com Login and go through tutorial and at Step 1 when you add your goals and refresh a page you can check the console for responses. You can see this issue when the response from goals is

data: null
path: "/goals"
type: "@@reactReduxFirebase/SET"

This is the specific container wrapper that I’m referring to: https://github.com/DeividasK/my-future-ai/blob/master/app/containers/tutorial/wrapper.js

0reactions
DeividasKcommented, Jan 24, 2017

In case this happens to others, this was something to do with the database. I have removed the user, for whom this was not working, and the data associated with the user. Then I signed up with the same user and it worked as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

orderByChild and equalTo not working with string like “+123”
Firebase Realtime Javascript SDK : orderByChild and equalTo not working with string like “+123” ... No worries, glad that you got it sorted....
Read more >
Use conditions in Realtime Database Security Rules - Firebase
In this example, we're using the $other variable to declare a .validate rule that ensures that widget has no children other than title...
Read more >
Collection Queries with Firebase
See how you get just the top-level keys? This is the only way to query Firebase data that does not return entire objects....
Read more >
Firebase Database Query | OrderBy - YouTube
orderbychild #orderbyvalue Easy Tutorial on Firebase Database Query.
Read more >
Firebase Realtime Database Rules Tutorial For Beginners
In this case, a user can read data from the users node only using the orderByChild('age') ordering function and the isEqual(37) querying ...
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