我正在使用MongoDB Java Client,并存储用逗号分隔的值,例如“ key”:“ 43,444,350,435,243,500,000”
现在,我想基于逗号分隔的值之一来获取记录,但操作失败
我在做什么
ArrayList<String> arr = new ArrayList<> ();
arr.add("500");
BasicDBObject sobj = new BasicDBObject();
sobj.put("key", new BasicDBObject("$in", arr));
long count= collection.countDocuments(sobj);
它给了我0个计数 我们不能使用$ regex,因为它将带出包含500的所有记录(如50063)。我们想要完全匹配
预先感谢