node-ottoman
node-ottoman copied to clipboard
How do I interact with views?
I'm migrating a project from MongoDB+Mongoose to CouchDB+Ottoman but there are some features I'm not sure if are missing.
-
I have a
postmodel and acommentmodels that include the ID of apost. In mongoose I defined a virtual field to count thesecomments. I know CouchDB has views just like any database but I can't figure out how to interact with them through Ottoman. Any guides or documentation? -
I also use virtual fields to populate a
postscomments but I can't find any mention of "populating" in the Ottoman docs. Can we do cross-schema populating with Ottoman the same way as I did with Mongoose?
Hello @danhab99 sorry for the delayed response.
-
Views are deprecated and will eventually be removed, so we don't encourage usage of Views. Can you write a N1QL Query or create an Ottoman pre-hook to accomplish what you need ?
-
Yes Ottoman supports ref and populate. You can find it in our documentation