-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
14 changed files
with
55 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -278,29 +278,29 @@ database: | |
|
||
.. code-block:: bash | ||
shell> curl -X PUT http://127.0.0.1:5984/test | ||
shell> curl -X PUT http://adm:pass@127.0.0.1:5984/test | ||
{"ok":true} | ||
Then we create a new document and the file attachment in one go: | ||
|
||
.. code-block:: bash | ||
shell> curl -X PUT http://127.0.0.1:5984/test/doc/file.txt \ | ||
shell> curl -X PUT http://adm:pass@127.0.0.1:5984/test/doc/file.txt \ | ||
-H "Content-Type: application/octet-stream" [email protected] | ||
{"ok":true,"id":"doc","rev":"1-287a28fa680ae0c7fb4729bf0c6e0cf2"} | ||
Now we can request the whole file easily: | ||
|
||
.. code-block:: bash | ||
shell> curl -X GET http://127.0.0.1:5984/test/doc/file.txt | ||
shell> curl -X GET http://adm:pass@127.0.0.1:5984/test/doc/file.txt | ||
My hovercraft is full of eels! | ||
But say we only want the first 13 bytes: | ||
|
||
.. code-block:: bash | ||
shell> curl -X GET http://127.0.0.1:5984/test/doc/file.txt \ | ||
shell> curl -X GET http://adm:pass@127.0.0.1:5984/test/doc/file.txt \ | ||
-H "Range: bytes=0-12" | ||
My hovercraft | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,10 +111,10 @@ Here's the worked sample above, using ``curl`` to simulate the form POST. | |
|
||
.. code-block:: bash | ||
$ curl -X PUT localhost:5984/testdb/_design/myddoc -d '{ "updates": { "contactform": "function(doc, req) { ... }" } }' | ||
$ curl -X PUT adm:pass@localhost:5984/testdb/_design/myddoc -d '{ "updates": { "contactform": "function(doc, req) { ... }" } }' | ||
{"ok":true,"id":"_design/myddoc","rev":"1-2a2b0951fcaf7287817573b03bba02ed"} | ||
$ curl --data "name=Lin&[email protected]&message=I Love CouchDB" http://localhost:5984/testdb/_design/myddoc/_update/contactform | ||
$ curl --data "name=Lin&[email protected]&message=I Love CouchDB" http://adm:pass@localhost:5984/testdb/_design/myddoc/_update/contactform | ||
* Trying 127.0.0.1... | ||
* TCP_NODELAY set | ||
* Connected to localhost (127.0.0.1) port 5984 (#1) | ||
|
@@ -139,5 +139,5 @@ Here's the worked sample above, using ``curl`` to simulate the form POST. | |
* Connection #1 to host localhost left intact | ||
{"success":"ok"} | ||
$ curl http://localhost:5984/testdb/lin\@example.com_2018-04-05T19:51:22.278Z | ||
$ curl http://adm:pass@localhost:5984/testdb/lin\@example.com_2018-04-05T19:51:22.278Z | ||
{"_id":"[email protected]_2018-04-05T19:51:22.278Z","_rev":"1-34483732407fcc6cfc5b60ace48b9da9","name":"Lin","email":"[email protected]","message":"I Love CouchDB"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -613,8 +613,8 @@ easy to make):: | |
|
||
Now we can use the database `albums-replica` as a replication target:: | ||
|
||
curl -X POST http://adm:pass@127.0.0.1:5984/_replicate \ | ||
-d '{"source":"http://adm:pass@127.0.0.1:5984/albums","target":"http://adm:pass@127.0.0.1:5984/albums-replica"}' \ | ||
curl -X POST http://admin:password@127.0.0.1:5984/_replicate \ | ||
-d '{"source":"http://admin:password@127.0.0.1:5984/albums","target":"http://admin:password@127.0.0.1:5984/albums-replica"}' \ | ||
-H "Content-Type: application/json" | ||
|
||
.. note:: | ||
|
@@ -681,8 +681,8 @@ and target members of our replication request are actually links (like in | |
HTML) and so far we've seen links relative to the server we're working on | ||
(hence local). You can also specify a remote database as the target:: | ||
|
||
curl -X POST http://adm:pass@127.0.0.1:5984/_replicate \ | ||
-d '{"source":"http://adm:pass@127.0.0.1:5984/albums","target":"http://user:[email protected]:5984/albums-replica"}' \ | ||
curl -X POST http://admin:password@127.0.0.1:5984/_replicate \ | ||
-d '{"source":"http://admin:password@127.0.0.1:5984/albums","target":"http://user:[email protected]:5984/albums-replica"}' \ | ||
-H "Content-Type:application/json" | ||
|
||
Using a *local source* and a *remote target* database is called *push | ||
|
@@ -700,14 +700,14 @@ You can also use a *remote source* and a *local target* to do a *pull | |
replication*. This is great for getting the latest changes from a server that | ||
is used by others:: | ||
|
||
curl -X POST http://adm:pass@127.0.0.1:5984/_replicate \ | ||
-d '{"source":"http://user:[email protected]:5984/albums-replica","target":"http://adm:pass@127.0.0.1:5984/albums"}' \ | ||
curl -X POST http://admin:password@127.0.0.1:5984/_replicate \ | ||
-d '{"source":"http://user:[email protected]:5984/albums-replica","target":"http://admin:password@127.0.0.1:5984/albums"}' \ | ||
-H "Content-Type:application/json" | ||
|
||
Finally, you can run remote replication, which is mostly useful for management | ||
operations:: | ||
|
||
curl -X POST http://adm:pass@127.0.0.1:5984/_replicate \ | ||
curl -X POST http://admin:password@127.0.0.1:5984/_replicate \ | ||
-d '{"source":"http://user:[email protected]:5984/albums","target":"http://user:[email protected]:5984/albums-replica"}' \ | ||
-H "Content-Type: application/json" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ to get the database information: | |
|
||
.. code-block:: bash | ||
shell> curl http://admin:password@127.0.0.1:5984 | ||
shell> curl http://127.0.0.1:5984 | ||
This returns the database information (formatted in the output below for | ||
clarity): | ||
|
@@ -65,13 +65,13 @@ clarity): | |
|
||
.. code-block:: bash | ||
shell> curl -X PUT 'http://127.0.0.1:5984/demo/doc' -d '{"motto": "I love gnomes"}' | ||
shell> curl -X PUT 'http://adm:pass@127.0.0.1:5984/demo/doc' -d '{"motto": "I love gnomes"}' | ||
you should replace it with: | ||
|
||
.. code-blocK:: bash | ||
.. code-block:: bash | ||
shell> curl -X PUT "http://127.0.0.1:5984/demo/doc" -d "{""motto"": ""I love gnomes""}" | ||
shell> curl -X PUT "http://adm:pass@127.0.0.1:5984/demo/doc" -d "{""motto"": ""I love gnomes""}" | ||
If you prefer, ``^"`` and ``\"`` may be used to escape the double-quote | ||
character in quoted strings instead. | ||
|
@@ -82,15 +82,15 @@ URL you send using a PUT request: | |
|
||
.. code-block:: bash | ||
shell> curl -X PUT http://user:[email protected]:5984/demo | ||
shell> curl -X PUT http://adm:[email protected]:5984/demo | ||
{"ok":true} | ||
But to obtain the database information you use a ``GET`` request (with | ||
the return information formatted for clarity): | ||
|
||
.. code-block:: bash | ||
shell> curl -X GET http://user:[email protected]:5984/demo | ||
shell> curl -X GET http://adm:[email protected]:5984/demo | ||
{ | ||
"compact_running" : false, | ||
"doc_count" : 0, | ||
|
@@ -120,7 +120,7 @@ submit a simple document to the ``demo`` database: | |
.. code-block:: bash | ||
shell> curl -H 'Content-Type: application/json' \ | ||
-X POST http://user:[email protected]:5984/demo \ | ||
-X POST http://adm:[email protected]:5984/demo \ | ||
-d '{"company": "Example, Inc."}' | ||
{"ok":true,"id":"8843faaf0b831d364278331bc3001bd8", | ||
"rev":"1-33b9fbce46930280dab37d672bbc8bb9"} | ||
|
@@ -133,7 +133,7 @@ that was returned: | |
|
||
.. code-block:: bash | ||
shell> curl -X GET http://user:[email protected]:5984/demo/8843faaf0b831d364278331bc3001bd8 | ||
shell> curl -X GET http://adm:[email protected]:5984/demo/8843faaf0b831d364278331bc3001bd8 | ||
{"_id":"8843faaf0b831d364278331bc3001bd8", | ||
"_rev":"1-33b9fbce46930280dab37d672bbc8bb9", | ||
"company":"Example, Inc."} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.