我的查询:
const query = ref.child(`/text_preview_user/${user_id}`).orderByChild('last_timestamp').limitToFirst(150);
query
.once("value")
.then((snapshot) => {
console.log(snapshot);
const orderedPromise = new Promise((resolve, reject) => {
let arr = [];
snapshot.forEach(function (childSnapshot) {
console.log(childSnapshot);
arr.push(childSnapshot.val());
});
resolve(arr);
});
orderedPromise.then((valueArr) => {
console.log(valueArr);
});
我的数据库:
我的索引:
我正在使用React native,关于.indexOn的滥用我没有收到任何错误。但是,当我运行模拟器时,它并不表明索引已被命中。我在Realtime DB文档中读到,“节点的键是自动索引的,因此不需要显式索引它。”但是我不确定那到底是什么意思。