I have a domain class with a username MyUserId
id < / Code>
@Document (collection = "user") Serializable {@property @ ID Private MyUser ID; for the implementation of public class user; @Version Private Integer Edition; Private string first name; // Setsers, Gators}
MyUserId
class:
public class applies MyUserId Serializable {@Property Private String userId ; @product private string sample; // Setters, Gators}
Inside my Mongo, document {_ ID: {userId: ....., sampleId: ....}, & lt Is being stored as; More fields here & gt;}
My user repository is like this:
Public Interface UserRepository enhanced MongoRepository & lt; User, MyUserId & gt; {@Query ("{'_' id :: {$ in:? 0}}") List & lt; Users & gt; FindByUserIds (archive & lt; MyUserId> userIds); }
When I ask a question from my userRepository, the query is being removed as:
{_ ID: {$ in: [[_class: "com .sampleuser.MyUserId", userId: "....", sampleId: "...."}, {_class: "com.sampleuser.MyUserId", user id: ".... It is clear that during the query this _ class is adding field, but not during storage. Can anyone put some light to fix it? This is causing all my questions to fail thanks !!
@Query
There really is a problem when using the whith complex ID type I recommend using a custom repository implementation until it is resolved.
Within the custom implementation you can use the MongoTemplate
to execute a query in any way @Override public list & lt ; Users & gt; FindByUserIds (collections & lt; MyUserId & gt; userIds) {return template.find (query (where ("user IDs"), user.class;}
Comments
Post a Comment