elixir-mongo / mongodb

MongoDB driver for Elixir
Apache License 2.0
568 stars 157 forks source link

Ability to query a mongodb view? #354

Open bryansray opened 3 years ago

bryansray commented 3 years ago

I'm attempting to query a mongodb view with

Mongo.find(:mongo, "users-tasks", %{})

... but getting this response back.

Namespace production.users-tasks is a view. Legacy find operations are not supported on views. Only clients which support the find command can be used to query views. 166

Does this driver not support querying views? I wasn't able to find any reference to views anywhere, unfortunately.

deadtrickster commented 3 years ago

Maybe it's related to using OP_QUERY against "user-tasks" vs using OP_QUERY against $cmd (i.e. doing it via commands).

bryansray commented 3 years ago

Thank you for the response, @deadtrickster!

Maybe it's related to using OP_QUERY against "user-tasks" vs using OP_QUERY against $cmd (i.e. doing it via commands).

Is this something I can control on my end? Or is it just a feature that this driver doesn't currently support?

zookzook commented 3 years ago

@bryansray: sorry for the 'advertising' for the https://hex.pm/packages/mongodb_driver. If I remember correctly, I implemented the support for views, because I needed it myself. Maybe you can try it. I just want to help, because I stumbled across the issue.