codeconsole commented on code in PR #15583:
URL: https://github.com/apache/grails-core/pull/15583#discussion_r3140076415


##########
grails-data-mongodb/core/src/main/groovy/org/grails/datastore/mapping/mongo/query/MongoQuery.java:
##########
@@ -138,11 +138,78 @@ public void handle(EmbeddedQueryEncoder queryEncoder, 
IdEquals criterion, Docume
                 Object value = criterion.getValue();
                 MappingContext mappingContext = entity.getMappingContext();
                 PersistentProperty identity = entity.getIdentity();
-                Object converted = 
mappingContext.getConversionService().convert(value, identity.getType());
+                // Prefer the configured storage type ('storedAs' on the id 
mapping) so query BSON

Review Comment:
   done



##########
grails-data-mongodb/core/src/main/groovy/org/grails/datastore/mapping/mongo/engine/MongoCodecEntityPersister.groovy:
##########
@@ -175,6 +178,32 @@ class MongoCodecEntityPersister extends 
ThirdPartyCacheEntityPersister<Object> {
         new Document(AbstractMongoObectEntityPersister.MONGO_ID_FIELD, key)
     }
 
+    /**
+     * Coerce an identifier value to the {@code storedAs} type declared in the 
entity's id
+     * mapping, so that point-lookup queries target the BSON type actually on 
disk.
+     * See {@code IdentityMapping#getStoredAs()}.
+     */
+    protected Object coerceIdToStoredType(Object key, PersistentEntity entity) 
{

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to