sgdocloader is a command line tool that makes it easy to add JSON documents to a Sync Gateway node.
You can download pre-built binaries for Mac OS X, Linux, and Windows and place them anywhere in your $PATH and you should be set.
If you prefer to build from source (and already have Go installed):
go get github.com/paulcapestany/sgdocloader
You're required to specify the Sync Gateway URL (including port) and bucket name, as well as the file(s) and/or directories that contain the JSON documents that you'd like to load.
sgdocloader -n http://127.0.0.1:4984 -b mybucket /path/to/some/data/directory
sgdocloader -n http://127.0.0.1:4984 -b mybucket somedata.json moredata.json
Load multiple documents from files via _bulk_docs by using the -k
flag:
sgdocloader -n http://127.0.0.1:4984 -b mybucket -k manydocs.json
The names of the files/directories don't matter. The _id
field for each doc will be auto-generated if not already included within the document(s). The heavy lifting is all done by the excellent go-couch package.
This is a work in progress, but comments/suggestions/pull requests are definitely welcomed!