在这种情况下,您需要使用文档ID作为条件。使用where方法来筛选具有特定文档ID的文档。例如,以下代码将选择具有特定文档ID的用户文档: 代码语言:txt 复制 var query = usersRef.where(firebase.firestore.FieldPath.documentId(), "==", "specific_document_id");...
log('No such document!'); } }).catch((error) => { console.log('Error getting document:', error); }); 方法2:使用where()方法和==操作符 如果您想要根据某个字段的值来查找文档,可以使用where()方法和==操作符。但是,请注意,Firestore的查询是基于索引的,因此这种方法可能不如直接使用文档引用高效...
即:在“TopCollection/document_this/NextCollection/document_that/Travesty/document_Id_I_want”中查找文档 使用集合组“Travesty” db.collectionGroup("Travesty") .where(firebase.firestore.FieldPath.documentId(), '==', "document_id_I_want") … 会 失败,但是… db.collectionGroup("Travesty") .where...
这是专门针对服务器SDK的 更新: Cloud Firestore 现在支持 IN 查询! myCollection.where(firestore.FieldPath.documentId(), 'in', ["123","456","789"]) 原文由 Nick Franceschina 发布,翻译遵循 CC BY-SA 4.0 许可协议 有用 回复 查看全部 2 个回答 推荐问题 js 如何将Key属性相同的放在同一个数组?
UUIDs (document) // Android int currentPhotoNumber = 13; firebaseFirestore.collection("photos").whereEqualTo("photo_id", currentPhotoNumber).get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { @Override public void onComplete(@NonNull Task<QuerySnapshot> task) { ...
I have the same issue. It seems findByXxxIn() where Xxx is not @DocumentId (so you have to assign an own identifier like UUID) is a workaround albeit a shitty one as FireStore probably uses the documentId for indexing and this might affect performance or costs (?)...
.where('members', 'array-contains', userID) .orderBy('lastLoggedAt', 'desc') .limit(2) .startAfter(startAfterVar) .onSnapshot(snapshot => { // Do something to store }); 免责声明:与实时侦听器进行分页很困难。 你所描述的是预期的行为。从该数据集开始: ...
where clausesUse standard firestore operations ==, >, >=, <, <=, !=, in, not-in, array-contains, array-contains-anyconst users = await User.findAll({ where: { years: { '>': 10, '<=': 40, }, }, })id clausesUse id clauses to filter by documentIdconst users = await ...
例如,可以通过以下方式初始化Firestorm实例: ```typescript import { Firestorm } from 'firestorm'; const config = { apiKey: 'YOUR_API_KEY', authDomain: 'YOUR_AUTH_DOMAIN', projectId: 'YOUR_PROJECT_ID', }; const db = new Firestorm(config); ``` 这里需要注意的是,`apiKey`, `authDomain`...
"value":"path/to/the/document" }, "__collections__":{ "employees":..., "products":... } }, "docB":..., "docC":... }, "administrators":{ "docA":..., "docB":... } } } where__collections__holds the collections for a given document (or the root of the database)....