0

我有两个功能:

async test1() {
  const items = await this.afs.collection(`items`).valueChanges().pipe(take(1)).toPromise());
  console.log(items.length);
}

async test2() {
  const items = await this.afs.collection(`accounts/trgdfedrtrtr4J/items`).valueChanges().pipe(take(1)).toPromise());
  console.log(items.length);
}

第一个给我 50 个结果,第二个给我 880 个结果,但他们都有 880 个项目!

有谁知道这可能是什么原因?我没有其他代码,所以 Firestore 在我收到它们时并没有发送所有项目。我也试过ref.limit(1000),但没有做任何事情。

4

1 回答 1

0

我切换到:

import * as firebase from 'firebase';

db = firebase.firestore();

const items = await this.db.collection(`items`).get();

检索所有结果。不知道是什么问题...

于 2018-09-18T00:26:40.703 回答