include::{commons}@data-commons::page$aot.adoc[]

== MongoDB Specific Ahead Of Time Features

[[aot.repositories.mongodb]]
=== MongoDB Ahead of Time Repositories

With Spring Data MongoDb we generally support query methods that are not backed by an xref:repositories/custom-implementations.adoc[implementation fragment], and don't require, with a few limitations detailed below.

[NOTE]
====
Reactive Repository interfaces using Project Reactor, Kotlin Coroutines et. al. are not supported.
====

**Supported Features**

* Derived `find`, `count`, `exists` and `delete` methods
* Query methods annotated with `@Query` (excluding those containing SpEL)
* Methods annotated with `@Aggregation`, `@Update`, and `@VectorSearch`
* `@Hint`, `@Meta`, and `@ReadPreference` support
* `Page`, `Slice`, and `Optional` return types
* DTO & Interface Projections

**Limitations**

* `@Meta.flags` is not evaluated.
* Limited `Collation` detection.
* No support for in-clauses with pattern matching / case insensitivity.
* Custom Collection return types (e.g. `io.vavr.collection`, `org.eclipse.collections`) are not yet supported.

**Excluded methods**

* `CrudRepository` and other base interface methods
* Querydsl and Query by Example methods
* Query Methods obtaining MQL from a file

[TIP]
====
Consider using `Pattern` instead of `String` as parameter type when working with derived queries using the `LIKE` keyword.
[source,java]
----
List<Person> findByLastnameLike(Pattern lastname);
----
====
