0
 result = firebase.get('chats/CONV000002').body.values


 result = {"-LEOiopfKHh82emTQBeS":{"arr_url":"https://test-vps2.s3.amazonaws.com/user_chats/IwnLnlERTxr/Test.pdf?AWSAccessKeyId=AKIAI4OQXXUZDIJGDDXA&Expires=1528369920&Signature=0UUnptN1jaJhfLCHpD2z%2BJHWnXo%3D","chat_date":"2018-06-07T10:12:00+00:00","employee_id":696,"f_name":"Test.pdf","guardian_id":"3710","message":"11","sender":"employee"},"-LEOirijIvapxuQgzRZZ":{"arr_url":"","chat_date":"2018-06-07T10:12:12+00:00","employee_id":696,"f_name":"","guardian_id":"3710","message":"how are you ?","sender":"employee"},"-LEOr8zBkjzLiZfl2ppq":{"arr_url":"","chat_date":"2018-06-07T13:48:24+03:00","employee_id":696,"f_name":"","guardian_id":"3167","message":"one","sender":"employee"},"-LEOrGr5nAuDEx3-VzyZ":{"arr_url":"","chat_date":"2018-06-07T13:48:56+03:00","employee_id":696,"f_name":"","guardian_id":"3167","message":"dsdsdsdsdsdsdsd","sender":"employee"}}

After Including Order By and Limit below error triggered.

firebase.get('chats/CONV000002', :orderBy => 'chat_date', :limitToFirst => 1).body.values
 Error:  ["orderBy must be a valid JSON encoded path"] 
Qmr
  • 64
  • 1
  • 7
  • Appreciate your response – Qmr Jun 07 '18 at 15:07
  • Looks like in your data it is `chat_date`, not `chart_date`. Is this a typo (here or somewhere else)? – André Kool Jun 07 '18 at 15:09
  • yes @Andre, which i have corrected still the same error – Qmr Jun 08 '18 at 04:07
  • Can you try putting `chat_date` in double quotes like this: `' "chat_date" '` (extra spaces added to make it more clear) ([source of this possible solution](https://github.com/ktamas77/firebase-php/issues/58)) – André Kool Jun 08 '18 at 08:13

0 Answers0