Like/2 in MongoDB adapter

Hi to all!
I’m using MongoDB adapter:
{:mongodb_ecto, github: "michalmuskala/mongodb_ecto", branch: "ecto-2.1"}

And I trying to use like/2.
But something is broken and I get the error:

** (Ecto.QueryError) Invalid expression for MongoDB adapter in where clause in query:

from a in MyApp.Airport,
       where: like(, "Br%"),
       select: a

source code:

       query = from a in Airport, where: like(, "Br%")

Any help would be greatly appreciated

For me its pretty clear from the error message, your adapter doesn’t support like/2, you’ll need to file an issue there.

For anyone else that comes across this post, you can find the corresponding issue here. But the crux of it is that the like/2 syntax is very specific to SQL. In place of it, we provide a regex module.

1 Like

@Ankhers Thank you very much!