Announcement Announcement Module
Collapse
No announcement yet.
[spring-data-mongodb] Inconsistent behavior with @Document and @Index Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [spring-data-mongodb] Inconsistent behavior with @Document and @Index

    Hi,

    I'm using the latest snapshot (1.0.0.BUILD-20110407.212906-219) for spring-data-mongodb.

    I noticed the following behavior when mixing @Document and @Indexed in a document object:

    1. @Document(collection = "foo") public class FooBar with @Indexed (where no collection specified in @Indexed)

    Data gets saved to collections "foo" and index gets generated on "foo". This is as expected.

    2. @Document public class FooBar with @Indexed (where no collection specified in @Document and @Indexed)

    Data gets saved to collections "fooBar" and index gets generated on "foobar". This is unexpected. I expected both data and index to be on "fooBar" (which is the class name by default).

    3. @Document public class FooBar with @Indexed(collection = "foo") (where no collection specified in @Document)

    Data gets save to collections "fooBar" and index gets generated on "foo". This is expected.

    4. @Document(collection = "foo") public class FooBar with @Indexed(collection = "foo")

    Data gets save to collections "fooBar" and index gets generated on "foo". This is unexpected. I expected data to be saved in "foo" also. Additionally, for this case I was also using @CompoundIndexes with no collection name specified, the index specified gets generated in "foo".

    Let me know if I'm doing anything wrong or if further details are needed.

    Thanks again.
Working...
X