I’m trying to convert this mongo shell to Mongotemplate, but I can’t find any way to do it.
Here is the shell:
db.userCustomSetting.deleteMany({$expr: {$regexMatch: {input: { $toString: "$_id" },regex: /.*0000$/}}});
I tried this:
Pattern regexPattern = Pattern.compile(".*0000$"); Query query = new Query(Criteria.where("_id").regex(regexPattern));
But it didn’t work.
New contributor
王大锤 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.