Open csm opened 12 years ago
If you create a design document, but don't specify any views in that document (for example, if you just add filters or validate_doc_update to the document) cradle will put your document under "views". This breaks things, obviously.
filters
validate_doc_update
The relevant code is:
// Design document if (/^_design\/(\w|%|\-)+$/.test(id) && !('views' in doc)) { document.language = "javascript"; document.views = doc; } else { document = doc; }
I worked around it in https://github.com/csm/cradle/commit/3f3f3e786ebeddef8921f45dea0a1ea1ab7024cc by just omitting the nonsense above. Maybe consider testing for the presence of other valid design document entries, so the change won't break code relying on the old behavior.
Also, a regex? Really?
You can use db.put() to update a view without going through the magic.
db.put()
magic
If you create a design document, but don't specify any views in that document (for example, if you just add
filters
orvalidate_doc_update
to the document) cradle will put your document under "views". This breaks things, obviously.The relevant code is:
I worked around it in https://github.com/csm/cradle/commit/3f3f3e786ebeddef8921f45dea0a1ea1ab7024cc by just omitting the nonsense above. Maybe consider testing for the presence of other valid design document entries, so the change won't break code relying on the old behavior.
Also, a regex? Really?