I need to write an extensive, yet logically simple (a bunch of if statements) code for my MAP function.
As I will need to rewrite a lot of code between different views I would like to know if I can import code into them.
I know that this is probably impossible with the current implementation of Couchbase, but I’m seriously considering building my own custom version, even if it implies messing a lot with the source code from it or even from V8.
Other thing that bothers me is the size limit for the document where the view code is stored, there’s a way to disable this?
I have done this just by bringing the externally defined functions (other than the one handling the document) in as part of the view. It works well, as long as you’re comfortable managing it a bit externally. I have one example in changedetector.
If you want to put them in a common area, there isn’t a standard way to do this that I know of. The source repo to look through for archeological clues is the this repository. You may find a simple include directory defined there somewhere. Or @vmx may be able to point you to somehting I’m not aware of.
I’m not familiar with the size limit-- how big is the view you’re trying to post?
I’m not aware of any size limits in regards to design documents. If you hit any, please give more details.
You currently can’t import code.
As coding views directly in the UI isn’t pleasant, I’d expect that you code them with some editor. As you say they’re quite complex I’d probably put them under version control. Easiest is then to add a build step which just concatenates the files you depend on, so that you end up with a single file per view.