Firestore exclude data serialization

后端 未结 3 1931
我在风中等你
我在风中等你 2021-01-01 16:30

I\'ve got several properties that should not be transferred to Firestore, such as metadata (\"id\" or \"parent\"), and with Firebase Realtime database, there was the option

3条回答
  •  盖世英雄少女心
    2021-01-01 17:01

    Grimthorr's answer didn't work for me. So, I put @Exclude annotation before the getter method of the field I want to exclude from writing to Firestore db, and it worked:

    @Exclude
    public String getId() {
        return id;
    }
    

提交回复
热议问题