简体   繁体   中英

Firestore relationship

Can someone explain how to organize the relationship between objects using Spring Boot and Firestore?

I am using spring-cloud-gcp-starter-data-firestore and I have two objects that must be located in different collections:

@Document(collectionName = "action_task")
public class ActionTask {

    @DocumentId
    private String id;
    ...........................
    
    private EventRule eventRule;
}

@Document(collectionName = "event_rule")
public class EventRulePair {

    @DocumentId
    private String id;

    ...................

    private String code;

    private String eventType;

    private Instant createdAt;
}

How organize relationships in the code and haw store in DB?

As suggested by @Frank van Puffelen, Data modeling is highly specific on the use-cases you want to implement. Unless you have a specific use-case in mind, Recommend watching the excellent video series 1

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