mongo db indexes on embedded documents

I have a domain object model as below...

     **social profile list:**
          **Interest list:**

Each profile can have many social profiles, in each social profile there are many interests related to the profile via the specific social profile ( social profile represent social network like Facebook), each interest is also embedded document with the fields id , type , value.

So I have two questions.. can I index few fields separately in the embedded document interest? can I create compound index in the embedded document interest?

I guess the complexity in my model is the deep level of the embedded document which is 2.. and that the path to that document is via arrays...

can it be done in spring way via metadata annotations? if you think my model is wrong please let me know I am a newbie on mongo Thanks


You can index separately on the fields in an embedded document.

You can also create a compound index on the fields, so long as no more than one field is an array.

These might offer more answers:

Need Your Help

Expand Tree to a specific level

jquery fancytree

is it possible to use node.setExpanded(true); to expand the tree only to a certain level?

move constructor for std::runtime_error

string exception c++11 move c++14

Why does std::runtime_error not provide a constructor accepting an std::string&&? Looking at the constructors for std::string, it has a move constructor, but the noexcept specification is o...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.