在 MongoDB 中,可以使用 $regex 和 $ne 两个操作符来查询正则长度不等于 10 的文档。举个例子:
db.collection.find({"field": {$regex: /^.{0,9}$/}, {$ne: "0123456789"}})
这将查询出长度小于10且不等于0123456789的文档
在 MongoDB 中,可以使用 $regex 和 $ne 两个操作符来查询正则长度不等于 10 的文档。举个例子:
db.collection.find({"field": {$regex: /^.{0,9}$/}, {$ne: "0123456789"}})
这将查询出长度小于10且不等于0123456789的文档