Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jnosql-dev] MongoDBDocumentManager optimization

Hi Otavio,

What do you think of opening a PR with this point?

Although I am not sure how to use aggregate (DefaultMongoDBTemplate) to get Entities.



On 6/15/2023 5:49 PM, Otavio Santana wrote:
Hey Dmitry, how are you?

What do you think of opening a PR with this point?

Thank you for the feedback.

On Tue, Jun 13, 2023 at 7:17 PM Dmitry Repchevsky via jnosql-dev <jnosql-dev@xxxxxxxxxxx> wrote:

Looking at the I noticed strange conversion
between Document -> BsonDocument in select/aggregate methods.

For instance:

MongoCollection<Document> collection =
AggregateIterable<Document> aggregate = collection.aggregate(pipeline);
return stream(aggregate.spliterator(), false)

It's much faster not to convert Bson (what mongo operates with) to the
Document and them back.

MongoCollection<BsonDocument> collection =
mongoDatabase.getCollection(collectionName, BsonDocument.class);
AggregateIterable<BsonDocument> aggregate = collection.aggregate(pipeline);
return stream(aggregate.spliterator(), false);

Is there something I am missing?

Kind regards,


jnosql-dev mailing list
To unsubscribe from this list, visit


Thanks a lot,

Twitter | Linkedin | Youtube

Back to the top