Is it possible to validate the data before it is entered into couchbase? I did not find any documentation confirming this. But I believe there must be some way to do it.
2 Answers
You can validate the input by adding another entity "validate_doc_update" to the _design/ document.The validate_doc_update function gets executed for each document you want to create or update. If the validation function raises an exception, the update is denied; when it doesn’t, the updates are accepted. It is optional i.e. if you do not write one, no checking will be done.
More details can be found on http://guide.couchdb.org/draft/validation.html
Couchbase will look at the data to make sure it is in a format it can store, but I doubtt that is what you mean by validation. If by data validation you mean that Couchbase will look at the data coming in and check it for a valid schema or something of that nature than no.
-
Can I force couch base to look for a valid datatype or format? Is there any function that I can trigger?– AshwinMar 12, 2015 at 5:30
-
Couchbase does not interrogate the data you tell it to store. Couchbase will tell you whether it is capable of storing that data or not. Anything else is up to you in your application code. This is both a positive and a negative, depending on your use case.– KirkMar 18, 2015 at 20:40