Open seneaLL opened 6 months ago
I can confirm this issue running the latest 1.1.22-canary.1+9d74b5bdc
, it drove me mad just now.
I have a larger collection; 106 docs. Running .get()
gets me between 100 and 106, depending on the run.
This is a major trap, cause it seems robust otherwise, with no signs of faliure. Node gets all the documents fine.
I encountered a similar issue when using Bun v1.1.27 with Firestore (firebase-admin 12.5.0).
Here’s a sample of my code for reproducing the issue:
import { initializeApp } from 'firebase-admin/app';
import { getFirestore } from 'firebase-admin/firestore';
initializeApp();
const firestore = getFirestore();
const collRef = firestore.collection('users').where('language', '==', 'zh-Hant');
const userColl01 = await collRef.get();
const userColl02 = await collRef.get();
const userColl03 = await collRef.get();
const userColl04 = await collRef.get();
const userColl05 = await collRef.get();
const userColl06 = await collRef.get();
const userColl07 = await collRef.get();
const userColl08 = await collRef.get();
const userColl09 = await collRef.get();
const userColl10 = await collRef.get();
console.log('userColl01.size:', userColl01.size);
console.log('userColl02.size:', userColl02.size);
console.log('userColl03.size:', userColl03.size);
console.log('userColl04.size:', userColl04.size);
console.log('userColl05.size:', userColl05.size);
console.log('userColl06.size:', userColl06.size);
console.log('userColl07.size:', userColl07.size);
console.log('userColl08.size:', userColl08.size);
console.log('userColl09.size:', userColl09.size);
console.log('userColl10.size:', userColl10.size);
Here are my results:
userColl01.docs.length => 1
userColl02.docs.length => 5
userColl03.docs.length => 1
userColl04.docs.length => 7
userColl05.docs.length => 1
userColl06.docs.length => 2
userColl07.docs.length => 1
userColl08.docs.length => 1
userColl09.docs.length => 1
userColl10.docs.length => 1
This inconsistent behavior seems similar to what you have described. It appears that the number of documents returned fluctuates between calls. The issue is not present when using NodeJS
What version of Bun is running?
1.0.30+1424a196f
What platform is your computer?
Linux 5.15.146.1-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
What is the expected behavior?
If there are, say, 4 documents in the collection, then when these elements are received, only 3 will be output, but if there is 1 document in the collection, nothing will be output (an empty array).
What do you see instead?
The correct number of documents must be displayed
Additional information
This also happens when using .where, and possibly other functions, but I haven't checked it. At the same time, everything is displayed correctly on Node 21.4.0.
Bun v1.0.30
Node v21.4.0