반응형
https://firebase.google.com/docs/firestore/query-data/order-limit-data
https://stackoverflow.com/questions/54244722/firestore-invalid-query-am-i-using-indexing-wrong
필터를 orderBy() 및 limit()와 결합할 수 있습니다. 다음 예시의 쿼리에서는 인구 기준을 정의하고,
인구를 오름차순으로 정렬하며, 기준을 초과하는 처음 몇 개의 결과만 반환합니다.
그러나 필터에 범위 비교(<, <=, >, >=)가 포함된 경우 동일한 필드를 기준으로 1차 정렬이 이루어져야 합니다.
const postDB = await dbService
.collection("PostDB")
.where("upVote", ">=", 0)
.orderBy("upVote")
.orderBy("time", "desc")
.limit(1);
반응형
'Firebase' 카테고리의 다른 글
파이어베이스에 CKEditor를 이용하여 이미지 등록 후 썸네일 불러오기 (0) | 2020.11.11 |
---|