Is it possible to fetch FaunaDB class schema or fields through fauna-shell or fauna-java API?
I am expecting fields and it datatypes for a given class or instance
Fauna doesn't have schema enforcement baked into it, so the only way to know what fields are present on a particular class instance is to fetch that instance and inspect it. You can find example queries for loading instances in the FaunaDB documentation.
You can also run a query like (excuse my JavaScript, it would look slightly different in Java.) q.Paginate(q.Indexes())
-- this will list all the indexes in a database. And q.Paginate(q.Classes())
will list the classes. A query like q.Get(q.Class("greetings"))
will load a particular classes schema, for indexes it looks like: q.Get(q.Index("all_greetings"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With