spring data - MongoDB projection exception -
i trying use projection in mongodb using mongorepository , jsonparserexception. below code:
@query(value= "{'regid': ?0, 'data': {$elemmatch: {'$or': [{'samplestep' :?1}, {'samplestep' : {$gt: ?1}, raw: ?2}]}}, 'ts': ?2, 'regid': ?2}") data findallbyid(objectid regid, string samplestep, boolean flag); exception message:
{'regid': ?0, 'data': {$elemmatch: {'$or': [{'samplestep' : "1000000000"}, {'samplestep' : {$gt: "1000000000"}, raw: true}]}}, 'ts': true, 'regid': true} ^] root cause com.mongodb.util.jsonparseexception: {'regid': ?0, 'data': {$elemmatch: {'$or': [{'samplestep' : "1000000000"}, {'samplestep' : {$gt: "1000000000"}, raw: true}]}}, 'ts': true, 'regid': true} can tell me wrong here. in advance.
the error using of ? in values. example, if replace:
{$gt: ?1} with
{$gt: 1} you not have exception.
i think following should removed:
'regid': ?0 probably there no regid==0. here objectid example:
objectid("507f1f77bcf86cd799439011") to read more objectids please follow link.
Comments
Post a Comment