Firestore exclude data serialization

后端 未结 3 1922
我在风中等你
我在风中等你 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 16:54

    To mark a field as excluded from the Firestore or Realtime database you can use the @Exclude annotation. For example:

    @IgnoreExtraProperties
    public class Model {
        @Exclude private String id;
    
        // ...
    }
    

    You can also use the @IgnoreExtraProperties annotation against the class to automatically ignore properties that don't map to class fields.

提交回复
热议问题