我在MongoDB上有一个SpringBoot应用程序。该数据库具有以下结构的文档。
我正在尝试在Repository类(扩展MongoRepository)中编写一个方法,该方法将允许我在以下位置获取文档:
最终,存储库类中的方法由Controller中的方法调用-本质上是一个REST API,可为这些API提供门名称,功能名称和期望值。我环顾四周,但没有找到类似的问题。如果我错过了一个已经提出的问题,请转介我到该问题。
{ "_id" : JUUID("80e5ab1b-cc46-48c2-b6f1-ef73db6b07d0"), "_class" : "com.mycompany.myservice.model.mymodel", "createDate" : ISODate("2018-10-15T18:54:52.000Z"), "field1Version" : "9850691", "field2Version" : "8950691", "field3Version" : "9967662", "field4Version" : "d047fb9", "type" : "META", "features" : [ { "featureName" : "FEATURE_1", "featureValue" : "true", "createDate" : ISODate("2018-10-15T05:59:21.000Z") } ], "gates" : [ { "gateName" : "GATE_1", "gateValue" : "true", "createDate" : ISODate("2018-10-15T05:59:21.000Z") }, { "gateName" : "GATE_2", "gateValue" : "false", "createDate" : ISODate("2018-10-18T08:59:21.000Z") }, { "gateName" : "GATE_3", "gateValue" : "true", "createDate" : ISODate("2019-02-11T02:46:01.000Z") } ] }, { "_id" : JUUID("80e5ab1b-cc46-48c2-b6f1-ef73db6b07d0"), "_class" : "com.mycompany.myservice.model.mymodel", "createDate" : ISODate("2018-10-15T18:54:52.000Z"), "field1Version" : "6789691", "field2Version" : "5980691", "field3Version" : "9997662", "field4Version" : "d047fb9", "type" : "META", "features" : [ { "featureName" : "FEATURE_1", "featureValue" : "true", "createDate" : ISODate("2018-10-15T05:59:21.000Z") } ], "gates" : [ { "gateName" : "GATE_1", "gateValue" : "true", "createDate" : ISODate("2018-10-15T05:59:21.000Z") }, { "gateName" : "GATE_2", "gateValue" : "true", "createDate" : ISODate("2018-10-18T08:59:21.000Z") }, { "gateName" : "GATE_3", "gateValue" : "true", "createDate" : ISODate("2019-02-11T02:46:01.000Z") } ] }