使用Firebase实时数据库索引

时间:2020-01-25 01:52:57

标签: firebase react-native firebase-realtime-database

我的查询:

    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);

            });

我的数据库:

enter image description here

我的索引:

enter image description here

我正在使用React native,关于.indexOn的滥用我没有收到任何错误。但是,当我运行模拟器时,它并不表明索引已被命中。我在Realtime DB文档中读到,“节点的键是自动索引的,因此不需要显式索引它。”但是我不确定那到底是什么意思。

0 个答案:

没有答案