erica
erica copied to clipboard
upload docs/*.json
- any .json files found in docs/ would be pushed to the couch as separate normal docs
- this should probably also be able to support attachments also
- use id if provided in doc
Good idea. I'm thinking to implement the feature like this
-
Push all json docs in _docs :
/_docs/*.json -> push all json docs
-
Allows to push a json and override properties by the content of a doc folder
/_docs/name.json /_docs/name/**
Which would allows to have /_docs/name/_attachments to add attachments
Questions to solve:
- how to handle existing docs in the db ? In couchapp docs were simply overridden by the version of the disk. Do we want to handle conflicts?
Don't overwrite by default, have "-f --force" options to overwrite.
what would be the behavior if we don't overwrite ? list them in the logs?
+1 to push all _docs/*.json
on conflicts etc, typical use case for this is uploading an existing data set, or initialising a new couchapp.
+1 for gdamjan's proposal on skipping if existent, unless --force or similar is required.
if one can push an arbitrary folder instead of _docs/ that would be great.
On attachments, do we need to support both inline and stub attachments?
re not overwriting, I think the best option would be to list a summary line "pushed X of Y docs" in stdio, and leave a log somewhere if required. People can always run in --verbose / --debug anyway to see all the detail if needed.
It's also handy to indicate if the input file wasn't valid JSON or wasn't accepted by CouchDB.
I would like to close this when the above pull request gets accepted. Then we can break the remaining todos listed in the pull request into separate issues to tackle.
this is implemented, right? should be documented