最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Querying "where" clause with document auto-id firebase - Stack Overflow

programmeradmin0浏览0评论

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:

.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

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

Share Improve this question asked May 21, 2018 at 13:19 zetza hzetza h 951 silver badge10 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

You can use FieldPath.documentId() to make queries involving the document id.

.collection("semesters").where(FieldPath.documentId(), "==", this.editSemId)
发布评论

评论列表(0)

  1. 暂无评论