Possible bug: Limit query returning wrong data

89 views
Skip to first unread message

Andy

unread,
Nov 19, 2013, 5:57:00 AM11/19/13
to fir...@googlegroups.com
I have found what seems to be a weird bug in either the Firebase Javascript lib or the API itself:

When using a simple ref.limit() query for a simple nested data structure, Firebase sometimes returns wrong data under specific conditions. I have set up a simple jsfiddle to demonstrate.

How to reproduce:

1. Open the demo at http://jsfiddle.net/yhv5u/9/ in two browser tabs to establish two connections
(ideally, create your own firebase and replace the URL to avoid any problems from other people testing it out)
2. Insert two new entries into the data structure
3. Delete the last entry
4. Reload one of the pages

Query:

ref.limit(10)

Returned data after page reload:

{
   parent: {
     firstChildName: true,
     secondChildName: {firstChildName: true} <-- weird! also, this was deleted
   }
 }

Expected data:
{
   parent: {
     firstChildName: true
   }
 }

The wrong data is only returned for the exact same query. Changing it, e.g. by changing or removing the limit, or looking at Forge shows the correct data.

I've also seen this after inserting data without subsequently deleting, but cannot reliably reproduce.

I'm grateful for any hints or workarounds.

Andy

unread,
Nov 23, 2013, 7:40:20 AM11/23/13
to fir...@googlegroups.com
Sorry, posted in the wrong group! :)

Sebastian Zartner

unread,
Nov 23, 2013, 12:38:34 PM11/23/13
to fir...@googlegroups.com
No problem. :-)

Sebastian
Reply all
Reply to author
Forward
0 new messages