I am developing a simple Social network and need help with mongorepository query. I have 2 documents:
@Document(collection = "post")
public class Post {
...........
@DBRef
@Field("settings")
private Settings settings;
and
@Document(collection = "settings")
public class Settings {
..............
@Field("privacy_settings")
private PrivacySettings privacySettings;
}
PrivacySettings is an enum with settings ONLY_ME, EVERYONE, FRIENDS.
And the situation is: a friend is viewing on my page and he can see my posts with correct privacy settings(etc. he can see only posts with PrivacySettings: EVERYONE, FRIENDS, but not the ONLY_ME). Ideas, how to resolve this problem? How to create a correct query?