KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a pojo annotated like this: @Document class Car { @Id String id ; @Indexed String manufacturer ; } And I am using MongoTemplate to insert into mongo. If I insert without specifying a collection name, everything works fine. However, if I specify a collection name, none of the indexes are created except for the _id one. I really need to be able to specify the collection name manually because: I need to ensure different subclasses of Car end up in the same collection I would like to store each year's worth of Cars in a separate collection Do I have to call ensureIndex() myself manually? If so, is there a way to do it that uses my @Indexed annotations? The actual objects I am trying to save are a lot more complex than 'Car'
Tags (comma-separated)
Save Edits
Cancel