You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thanks for the tools you made, that helped me a lot :)
I am having trouble to use couchdb-bootstrap with CommonJS modules though. I would like to be able to write any view, filter or validation function in a module, so that i can unit test it. I am sure this is possible, as you mention that in the README.
My problem is that the generated _design documents are not as i would expect them to be.
I have to mention that i am pretty new with CouchDB, so i probably might be missing something obvious...
Here is the structure i am trying to use (only a small relevant part):
├── package.json
├── bin
│ └── bootstrap.js
├── tests
│ └── // Here i will test my CJS modules with Jest
└── src
├── _users
│ ├── alice.json
│ └── bob.json
├── official-db
│ ├── _design
│ │ └── validation
│ │ ├── index.js
│ │ └── validate_doc_update.js
│ ├── _security.json
│ └── adoc.json
├── alice-db
│ └── _security.json
└── bob-db
└── _security.json
I run the bootstrap process with a custom script (bin/bootsrap.js) which basically only executes your module with my CouchDB server admin credentials, passes the index = true option, and generate a report of what have been done. (I don't think the problem comes from that script, so i'm not including it in this issue)
Following the README, here is the content of my official-db/_design/validation folder :
// index.jsmodule.exports={validate_doc_update: require("./validate_doc_update")};// validate_doc_update.jsmodule.exports=function(newDoc,oldDoc,userCtx,secObj){throw{forbidden: "Nobody can update anything here !!"};// this is only pseudo code to test :)};
In the official-db database, i would have expected the validation design document to be like :
My main concern is that the module.export is not stripped out, so the database is "broken" with the error Save failed: Expression does not eval to a function.
If i run the command couchdb-compile src --index, the problem remains, but if i couchdb-compile src/official-db/_design/validation --index, everything works :
As far as i understand the code from couchdb-compile, the option index is only used for the root folder, and is not recursive. Shouldn't it be ?
I am sorry for this long issue, but i have been stuck on it for the whole day, and i really need some help... I hope i have provided enough details to get some :) Let me know if you need more infos !
Thanks a lot, regards
The text was updated successfully, but these errors were encountered:
Let me know if i can help you in any way to resolve this issue, and thank you for the job you have done on these CouchDB tools, i can now relax for real :)
Hi there,
First, thanks for the tools you made, that helped me a lot :)
I am having trouble to use
couchdb-bootstrap
with CommonJS modules though. I would like to be able to write any view, filter or validation function in a module, so that i can unit test it. I am sure this is possible, as you mention that in the README.My problem is that the generated _design documents are not as i would expect them to be.
It might be related to #49
I have to mention that i am pretty new with CouchDB, so i probably might be missing something obvious...
Here is the structure i am trying to use (only a small relevant part):
I run the bootstrap process with a custom script (
bin/bootsrap.js
) which basically only executes your module with my CouchDB server admin credentials, passes theindex = true
option, and generate a report of what have been done. (I don't think the problem comes from that script, so i'm not including it in this issue)Following the
README
, here is the content of myofficial-db/_design/validation
folder :In the
official-db
database, i would have expected the validation design document to be like :But instead, i end up with that :
My main concern is that the
module.export
is not stripped out, so the database is "broken" with the errorSave failed: Expression does not eval to a function
.If i run the command
couchdb-compile src --index
, the problem remains, but if icouchdb-compile src/official-db/_design/validation --index
, everything works :As far as i understand the code from
couchdb-compile
, the optionindex
is only used for the root folder, and is not recursive. Shouldn't it be ?I am sorry for this long issue, but i have been stuck on it for the whole day, and i really need some help... I hope i have provided enough details to get some :) Let me know if you need more infos !
Thanks a lot, regards
The text was updated successfully, but these errors were encountered: