erica icon indicating copy to clipboard operation
erica copied to clipboard

upload docs/*.json

Open dch opened this issue 14 years ago • 7 comments

  • 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

dch avatar Nov 15 '11 22:11 dch

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?

benoitc avatar Nov 23 '11 06:11 benoitc

Don't overwrite by default, have "-f --force" options to overwrite.

gdamjan avatar Nov 24 '11 04:11 gdamjan

what would be the behavior if we don't overwrite ? list them in the logs?

benoitc avatar Nov 24 '11 07:11 benoitc

+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?

dch avatar Nov 24 '11 16:11 dch

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.

dch avatar Nov 24 '11 16:11 dch

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.

ryanramage avatar Oct 15 '12 16:10 ryanramage

this is implemented, right? should be documented

gdamjan avatar Feb 27 '15 23:02 gdamjan