1

我用于在我的 Java Spring 应用程序中spring-cloud-gcp-starter-data-firestore访问Google Cloud Firestore 。

目前,我的实体如下所示:

public class Subscription {

    public String userId;
    public String companyId;

    // other properties

}

但是,我通过in获得userIdand 。companyIdreactor.core.publisher.Monoorg.springframework.security.core.context.ReactiveSecurityContextHolder

如何在Mono不诉诸于 s 的情况下保留嵌套在 s中的两个属性Mono#block

4

2 回答 2

0

我建议按照Google codelab中的教程进行操作。

在这里您可以发现 Firestore 可以处于 Datastore 模式,这使得上一个教程适合您。

于 2020-01-29T14:29:03.653 回答
0

我现在正在使用Mono#zipWith将两者结合起来Mono。然后我在里面创建实体Mono#flatMap

service.getCompanyId()
   .zipWith(service.getUserId())
   .flatMap(objects -> createEntity(objects.getT1(), objects.getT2()))
于 2020-01-28T16:27:53.680 回答