MongoRepository get only specific field as result
问题 i am using Mongodb in Spring Web. And use MongoRepository to CRUD I had: Collection: User Later, i had to create a Group. because i shouldn't and can't embedded User into Group. I create new collection as SQL name: GroupUser. In here, i use: @Field("groupId") private String groupId; @DBRef private User user; this will help to query list user in Group (query data and auto get User's content) But as i want to get the list User's Id. Normally, in SQL we can do like: select user.id from GroupUser