java spring mongodb elemMatch用法


java 使用spring框架查询方法

Criteria.where("products").elemMatch(Criteria.where("status").is(1).and("productId").is(channelId))

对应的查询语句

db.tableName.find({"products":{"$elemMatch":{"productId":"4fa7367089cc56e4083cb7a8","status":1}}})

你可能感兴趣的:(mongodb)