简体   繁体   中英

Querying “where” clause with document auto-id firebase

I'm currently in a project using Firebase Cloud Firestore and VueJS.

I have this “where” clause, which needs the id of the selected collection. Basically it has to update, where the document id has the this.editSemId. There's some other stuff to the method, but all I need is a way to get the document id from within my collection of semesters in firebase:

Here's how it works: http://recordit.co/Hu67ekLWHv

.collection(“semesters”) .where(“DOCUMENT_ID”, “==”, this.editSemId)

I know how to “get” the document id, which is done with the “this.editSemId”, but I don't know how to get it for the above query

您可以使用FieldPath.documentId()进行涉及文档ID的查询。

.collection("semesters").where(FieldPath.documentId(), "==", this.editSemId)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM