jeudi 2 avril 2015

Advice on MongoDB Database Structure

I have Photo, Video ,Friend and User table in mongoDB.


MongoDB is not support join , so to overcome this issue I have my following way and I want to know it is right or is there any better solution.


In a User object I need friend count, photo count and video count. so to get the friend count I fire a query on friend table and for photo and video vise verse.


And I have another solution to set firend, photo and video Object store in to the User table like ,



@Document
Class User {

List<String> friendIds;

List<String> phtotIds;

List<String> videoIds;
}

Aucun commentaire:

Enregistrer un commentaire