首页 > 解决方案 > Firebase startat timestamp issue?

问题描述

I have an issue with firebase. I'm trying to start at specific timestamp, but it seems like it's not starting at the specified timestamp. In the log you can see the variable this.state.timeAtMount is greater than the date_add child.

    ref
          .orderByChild('date_add')
          .startAt(this.state.timeAtMount)
          .on('child_added', snapshot => {


            console.log('TIME MOUNT', this.state.timeAtMount);
            console.log('ANSWERS TO REPLY child_added', snapshot);
})

THE LOG :

TIME MOUNT 1574536646740
ANSWERS TO REPLY child_added Object {
  "author": "MJE3PrCYJXT4yv2LHF9S229CLRA2",
  "date_add": 1574535388800,
  "question": "S",
}
TIME MOUNT 1574536646740
ANSWERS TO REPLY child_added Object {
  "author": "MJE3PrCYJXT4yv2LHF9S229CLRA2",
  "date_add": 1574535448836,
  "question": "Sss",
}
TIME MOUNT 1574536646740
ANSWERS TO REPLY child_added Object {
  "author": "MJE3PrCYJXT4yv2LHF9S229CLRA2",
  "date_add": 1574536634684,
  "question": "S",
}

标签: javascriptfirebasefirebase-realtime-database

解决方案


推荐阅读