我有一个要实现为Spring Mongo存储库的mongo查询
db.collection.find({ 'items':
{ $elemMatch: {
'refund.$id' : ObjectId('5638cab2e4b07ff212618d7e')
}
}
})
Run Code Online (Sandbox Code Playgroud)
我的存储库界面是
@Query("{ 'items': { $elemMatch: { 'refund.$id' : ObjectId(?0) } } }")
RMA findRMAByItemRefund(String refundId);
Run Code Online (Sandbox Code Playgroud)
抛出JSONParseException
Caused by: com.mongodb.util.JSONParseException:
{ 'items': { $elemMatch: { 'refund.$id' : ObjectId("_param_0") } } }
^
at com.mongodb.util.JSONParser.parse(JSON.java:216)
Run Code Online (Sandbox Code Playgroud)