I have a document with an array. I want to delete the document if array exists and size is of 0.
I came up with this mongodb query(something similar)
document.remove({ comments: { $exists: true, $size: 0 } })
please help me in converting this mongodb query to spring-data-mongodb or suggest me if there is any better solution for this.
假设您有一个Document
类。
mongoTemplate.remove(new Query(Criteria.where("comments").exists(true).size(0)), Document.class);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.