We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debug code, :
Query query=Query.query(new Criteria().orOperator( Criteria.where("sendUserCode").is("aa"),Criteria.where("sendUserCode").is("bb") )); query.with(Sort.by(Sort.Order.desc("sendTime"))); final List<CoEntity> coList = mongoTemplate.find(query,CoEntity.class);
debug step in main branches : MongoTemplate#find
protected <S, T> List<T> doFind(String collectionName, CollectionPreparer<MongoCollection<Document>> collectionPreparer, Document query, Document fields, Class<S> entityClass, @Nullable CursorPreparer preparer, DocumentCallback<T> objectCallback) { MongoPersistentEntity<?> entity = mappingContext.getPersistentEntity(entityClass); QueryContext queryContext = queryOperations.createQueryContext(new BasicQuery(query, fields)); Document mappedFields = queryContext.getMappedFields(entity, EntityProjection.nonProjecting(entityClass)); Document mappedQuery = queryContext.getMappedQuery(entity); if (LOGGER.isDebugEnabled()) { Document mappedSort = getMappedSortObject(query, entityClass); LOGGER.debug(String.format("find using query: %s fields: %s sort: %s for class: %s in collection: %s", serializeToJsonSafely(mappedQuery), mappedFields, serializeToJsonSafely(mappedSort), entityClass, collectionName)); } return executeFindMultiInternal(new FindCallback(collectionPreparer, mappedQuery, mappedFields, null), preparer != null ? preparer : CursorPreparer.NO_OP_PREPARER, objectCallback, collectionName); }
focus code:
Document mappedSort = getMappedSortObject(query, entityClass); serializeToJsonSafely(mappedSort)
expect sort: { "sendTime" : -1} but sort: { "$or" : [{ "sendUserCode" : "aa"}, { "sendUserCode" : "bb"}]}
sort: { "sendTime" : -1}
sort: { "$or" : [{ "sendUserCode" : "aa"}, { "sendUserCode" : "bb"}]}
The text was updated successfully, but these errors were encountered:
Feel free to submit a pull request. It would also make sense to cross-check with the reactive implementation.
Sorry, something went wrong.
No branches or pull requests
debug code, :
debug step in main branches : MongoTemplate#find
focus code:
expect
sort: { "sendTime" : -1}
but
sort: { "$or" : [{ "sendUserCode" : "aa"}, { "sendUserCode" : "bb"}]}
The text was updated successfully, but these errors were encountered: