通过mongo中的嵌套和其他列查找永远不会返回数据

时间:2018-01-10 01:05:59

标签: java spring mongodb spring-data-mongodb

我有以下查询:

{'carCollectionStatuses': 'BELOW_ONE_HUNDRED', 'carCollection.carID':'e711c3aa-e073-0cd4-29e0-db2e503b61a0'}

返回:

{ 
    "_id" : ObjectId("5a4bf83ae261b4cc9045d36d"), 
    "name" : "Colecao cabrita", 
    "title" : "Colecao selecionada a dedo", 
    "subtitle" : "Só carros que vão parar de funcionar", 
    "pictureUrl" : "http://www.google.com", 
    "carCollection" : [
        {
            "partnerName" : "-------", 
            "photo" : "https://--------", 
            "_id" : ObjectId("59d7cac33fde150006d24856"), 
            "location" : [
                11123.21729, 
                1146.4362
            ], 
            "carModel" : "LOGAN Expression Hi-Flex 1.6 8V 4p", 
            "carBrand" : "Renault", 
            "carID" : "e711c3aa-e073-0cd4-29e0-db2e222b61a0"
        }, 
        {
            "partnerName" : "-------", 
            "photo" : "---------", 
            "_id" : ObjectId("59dbc9701755db00069a4157"), 
            "location" : [
                11123.21729, 
                1146.4362
            ], 
            "carModel" : "Megane Grand Tour Dynam. Hi-Flex 1.6 16V", 
            "carBrand" : "Renault", 
            "carID" : "e71125ad-70fc-f563-0000-db2e503b61a0"
        }
    ], 
    "__v" : NumberInt(0), 
    "carCollectionStatuses" : [
        "BELOW_ONE_HUNDRED"
    ]
}

使用spring-data-mongodb:

@Query("{'carCollectionStatuses': ?0, 'carCollection.carID': ?1}")
CarCollectionHolderEntity findBycarCollectionStatusesAndCarCollectionCarID(CarCollectionStatus status, String carID);

我的问题是,直接使用MQL我有一个匹配的查询,但是使用spring-mongo这个查询永远不会返回数据,我做错了什么?

由于

0 个答案:

没有答案