在嵌入列表的最大日期查询mongodb

时间:2018-03-06 10:54:04

标签: java mongodb spring-data-mongodb

我有json,如下所示我想建立查询,以便我将传递一个日期,我想如果囤积包含statusQueues然后最大campaignEndDate小于输入的日期应返回。我怎么能这样做?

"hoardings" : [ {     
      "isActive" : false,
      "id" : "5a9a4c7af5369628809e8124",      
      "statusQueues" : [ {
        "campaignStartDate" : "03 Mar, 2018",
        "campaignEndDate" : "27 Mar, 2018",
        "module" : "Campaign"
      }, {
        "campaignStartDate" : "03 Mar, 2018",
        "campaignEndDate" : "28 Mar, 2018",
        "module" : "Campaign"
      }, {
        "campaignStartDate" : "03 Mar, 2018",
        "campaignEndDate" : "29 Mar, 2018",
        "module" : "Campaign"
      },
{
        "campaignStartDate" : "03 Mar, 2018",
        "campaignEndDate" : "20 Mar, 2018",
        "module" : "Campaign"
      } ]      
    },
 {     
      "isActive" : false,
      "id" : "5a9a4c7af5369628809e8125",      
      "statusQueues" : [  ]      
    }]

我尝试过使用mongoTemplate但无法为此编写查询。

0 个答案:

没有答案