react-native-firebase orderBy 查询不起作用

问题描述 投票:0回答:1

我尝试对数据进行排序,然后使用以下查询从数据库中获取它们:

import firestore from '@react-native-firebase/firestore'
   // not working
 const query = await firestore().collection('col').orderBy('createdAt', 'desc').where('age', ==, '123').get()

  // this is working but not sorted
  const query = await firestore().collection('col').where('age', ==, '123').get()

我还发现

react-native-firebase/firestore
(v12.9.2)不支持
startAt
。感觉有些不对劲,根据文档,这些功能在 React Native 中都是支持的

firebase react-native react-native-firebase
1个回答
0
投票

查询前需要在 Firebase 中设置索引。

© www.soinside.com 2019 - 2024. All rights reserved.