Is it possible to fetch relationship doc in Couch DB validation document #3278
-
Hi techies, We are using Couch DB for the past three years. For the form level validation, we are using validation design document to validate the each field values once the document changes happened. Its working fine as expected. Now we are in another requirement which is, we need to validate the field values with other dependent type of document. Lets take an example. I have Sales order object and discount configuration object. Discount configuration is the reference relationship object in sales order. Both have different types of fields and its available as document in Couch DB. We have defined the sales discount percentage in discount configuration object document. And assume that, discount percentage field available in Sales order object also. When the user enter the values for sales order, discount percentage value should not exceeded with discount percentage field value which is available in discount configuration object. Discount Configuration Document: Sales order document: When I enter the sales order information in the form, I have to fill sales_amount and discount_percentage. Bill amount will be calculated based on discount percentage. When I click the save action. I need to validate whether sales order discount percentage should not exceed with discount configuration object discount percentage using validation design document. As of my working experience in couch db validation document, we can get the single primary old and new document only. Is it possible to get the relationship(discount configuration) documents ? Please advise or suggest the feasibility on my query. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
No, it is not possible. The VDU only has access to the document that is being changed. You should perform this validation at the application tier. |
Beta Was this translation helpful? Give feedback.
No, it is not possible. The VDU only has access to the document that is being changed.
You should perform this validation at the application tier.