亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我如何獲得 blogpostId firestore?

我如何獲得 blogpostId firestore?

HUWWW 2021-12-18 15:11:36
我的問題是從 firestore 獲取文檔 ID。我如何獲取 Users/documentid/Comments/documentid ?數據類:public class BlogPostId {  @Exclude  public String BlogPostId;  public <T extends BlogPostId> T withId(@NonNull final String id) {    this.BlogPostId = id;    return (T) this;  }}添加活動:private String blog_post_id;Oncreateblog_post_id = getIntent().getStringExtra("blog_post_id");btn clickfinal String descff = icerikedit.getText().toString();Map<String, Object> commentsMap = new HashMap<>();            commentsMap.put("descff", descff);            commentsMap.put("user_id", current_user_id);            commentsMap.put("timestamp", FieldValue.serverTimestamp());            firebaseFirestore.collection("Users/"+blog_post_id+"/Comments").add(commentsMap).addOnCompleteListener(new OnCompleteListener<DocumentReference>() {    @Override    public void onComplete(@NonNull Task<DocumentReference> task) {        if(task.isSuccessful()){            Toast.makeText(FFicerikAdd.this, "Ba?ar?l? efe!", Toast.LENGTH_SHORT).show();            Intent sab=new Intent(getApplicationContext(),FFicerik.class);            sab.putExtra("blog_post_id",blog_post_id);            startActivity(sab);        }
查看完整描述

1 回答

?
尚方寶劍之說

TA貢獻1788條經驗 獲得超4個贊

不幸的是,在云計算公司的FireStore沒有辦法得到的名稱Mehmet在中存在哪些zSNQ...mUUF文件和名稱ahmet的范圍內它存在SinifDevam于一個單一的查詢文檔。

Firestore 中的查詢很淺,它們只從運行查詢的集合中獲取項目。無法在單個查詢中從另一個頂級集合或子集合中獲取文檔。Firestore 不支持一步跨不同集合的查詢。單個查詢只能在使用的文件的屬性只有一個單一的集合。

要解決此問題,您應該在單個集合中添加所有用戶對象并相應地查詢它。


查看完整回答
反對 回復 2021-12-18
  • 1 回答
  • 0 關注
  • 135 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號