Skip to content

Commit e4fa8f9

Browse files
committed
reviewed and made minor pattern updates
1 parent 93e7342 commit e4fa8f9

File tree

7 files changed

+80
-77
lines changed

7 files changed

+80
-77
lines changed

couchdb/bash/create_document_DB.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ echo $BEATRIX_EMORY
1414
echo $INFERNO_FLARE
1515

1616
# Create document with dynamic id allocation
17-
jq -n "$JOXOS" | curl -H 'Content-Type:application/json' -X POST 'http://localhost:5984/heroes' -d @-
18-
jq -n "$VI" | curl -H 'Content-Type:application/json' -X POST 'http://localhost:5984/heroes' -d @-
19-
jq -n "$ROKH_AEGIS" | curl -H 'Content-Type:application/json' -X POST 'http://localhost:5984/heroes' -d @-
20-
jq -n "$TRANQUILITY" | curl -H 'Content-Type:application/json' -X POST 'http://localhost:5984/heroes' -d @-
21-
jq -n "$BEATRIX_EMORY" | curl -H 'Content-Type:application/json' -X POST 'http://localhost:5984/heroes' -d @-
22-
jq -n "$INFERNO_FLARE" | curl -H 'Content-Type:application/json' -X POST 'http://localhost:5984/heroes' -d @-
17+
jq -n "$JOXOS" | curl -H 'Content-Type:application/json' -X POST 'http://admin:password@localhost:5984/heroes' -d @-
18+
jq -n "$VI" | curl -H 'Content-Type:application/json' -X POST 'http://admin:password@localhost:5984/heroes' -d @-
19+
jq -n "$ROKH_AEGIS" | curl -H 'Content-Type:application/json' -X POST 'http://admin:password@localhost:5984/heroes' -d @-
20+
jq -n "$TRANQUILITY" | curl -H 'Content-Type:application/json' -X POST 'http://admin:password@localhost:5984/heroes' -d @-
21+
jq -n "$BEATRIX_EMORY" | curl -H 'Content-Type:application/json' -X POST 'http://admin:password@localhost:5984/heroes' -d @-
22+
jq -n "$INFERNO_FLARE" | curl -H 'Content-Type:application/json' -X POST 'http://admin:password@localhost:5984/heroes' -d @-
2323

2424
# Create document with custom id
25-
jq -n "$JOXOS" | curl -H 'Content-Type:application/json' -X PUT 'http://localhost:5984/heroes/JOXOS' -d @-
26-
jq -n "$VI" | curl -H 'Content-Type:application/json' -X PUT 'http://localhost:5984/heroes/VI' -d @-
27-
jq -n "$ROKH_AEGIS" | curl -H 'Content-Type:application/json' -X PUT 'http://localhost:5984/heroes/ROKH_AEGIS' -d @-
28-
jq -n "$TRANQUILITY" | curl -H 'Content-Type:application/json' -X PUT 'http://localhost:5984/heroes/TRANQUILITY' -d @-
29-
jq -n "$BEATRIX_EMORY" | curl -H 'Content-Type:application/json' -X PUT 'http://localhost:5984/heroes/BEATRIX_EMORY' -d @-
30-
jq -n "$INFERNO_FLARE" | curl -H 'Content-Type:application/json' -X PUT 'http://localhost:5984/heroes/INFERNO_FLARE' -d @-
25+
jq -n "$JOXOS" | curl -H 'Content-Type:application/json' -X PUT 'http://admin:password@localhost:5984/heroes/JOXOS' -d @-
26+
jq -n "$VI" | curl -H 'Content-Type:application/json' -X PUT 'http://admin:password@localhost:5984/heroes/VI' -d @-
27+
jq -n "$ROKH_AEGIS" | curl -H 'Content-Type:application/json' -X PUT 'http://admin:password@localhost:5984/heroes/ROKH_AEGIS' -d @-
28+
jq -n "$TRANQUILITY" | curl -H 'Content-Type:application/json' -X PUT 'http://admin:password@localhost:5984/heroes/TRANQUILITY' -d @-
29+
jq -n "$BEATRIX_EMORY" | curl -H 'Content-Type:application/json' -X PUT 'http://admin:password@localhost:5984/heroes/BEATRIX_EMORY' -d @-
30+
jq -n "$INFERNO_FLARE" | curl -H 'Content-Type:application/json' -X PUT 'http://admin:password@localhost:5984/heroes/INFERNO_FLARE' -d @-

couchdb/bash/delete_DB.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Delete Database
2-
curl -X DELETE http://localhost:5984/heroes
2+
curl -X DELETE http://admin:password@localhost:5984/heroes

couchdb/bash/delete_document_DB.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Delete Document - CAN BE IMPROVED - LOOP: GRAB REV, PARSE, CREATE URL, DELETE DOCUMENT
22

33
# Grab Latest Revision and Save to File
4-
curl -X GET 'http://localhost:5984/heroes/JOXOS?revs=true' | jq '._rev' > joxos_rev.txt
5-
curl -X GET 'http://localhost:5984/heroes/VI?revs=true' | jq '._rev' > vi_rev.txt
6-
curl -X GET 'http://localhost:5984/heroes/ROKH_AEGIS?revs=true' | jq '._rev' > rokh_aegis_rev.txt
7-
curl -X GET 'http://localhost:5984/heroes/TRANQUILITY?revs=true' | jq '._rev' > tranquility_rev.txt
8-
curl -X GET 'http://localhost:5984/heroes/BEATRIX_EMORY?revs=true' | jq '._rev' > beatrix_emory_rev.txt
9-
curl -X GET 'http://localhost:5984/heroes/INFERNO_FLARE?revs=true' | jq '._rev' > inferno_flare_rev.txt
4+
curl -X GET 'http://admin:password@localhost:5984/heroes/JOXOS?revs=true' | jq '._rev' > joxos_rev.txt
5+
curl -X GET 'http://admin:password@localhost:5984/heroes/VI?revs=true' | jq '._rev' > vi_rev.txt
6+
curl -X GET 'http://admin:password@localhost:5984/heroes/ROKH_AEGIS?revs=true' | jq '._rev' > rokh_aegis_rev.txt
7+
curl -X GET 'http://admin:password@localhost:5984/heroes/TRANQUILITY?revs=true' | jq '._rev' > tranquility_rev.txt
8+
curl -X GET 'http://admin:password@localhost:5984/heroes/BEATRIX_EMORY?revs=true' | jq '._rev' > beatrix_emory_rev.txt
9+
curl -X GET 'http://admin:password@localhost:5984/heroes/INFERNO_FLARE?revs=true' | jq '._rev' > inferno_flare_rev.txt
1010

1111
# Remove Qoutes from Revision
1212
sed 's/\"//g' joxos_rev.txt > joxos_rev_value.txt
@@ -32,12 +32,12 @@ echo $BEATRIX_EMORY_REV
3232
echo $INFERNO_FLARE_REV
3333

3434
# Combine Revision with URL
35-
JOXOS_URL="http://localhost:5984/heroes/JOXOS?rev=$JOXOS_REV"
36-
VI_URL="http://localhost:5984/heroes/VI?rev=$VI_REV"
37-
ROKH_AEGIS_URL="http://localhost:5984/heroes/ROKH_AEGIS?rev=$ROKH_AEGIS_REV"
38-
TRANQUILITY_URL="http://localhost:5984/heroes/TRANQUILITY?rev=$TRANQUILITY_REV"
39-
BEATRIX_EMORY_URL="http://localhost:5984/heroes/BEATRIX_EMORY?rev=$BEATRIX_EMORY_REV"
40-
INFERNO_FLARE_URL="http://localhost:5984/heroes/INFERNO_FLARE?rev=$INFERNO_FLARE_REV"
35+
JOXOS_URL="http://admin:password@localhost:5984/heroes/JOXOS?rev=$JOXOS_REV"
36+
VI_URL="http://admin:password@localhost:5984/heroes/VI?rev=$VI_REV"
37+
ROKH_AEGIS_URL="http://admin:password@localhost:5984/heroes/ROKH_AEGIS?rev=$ROKH_AEGIS_REV"
38+
TRANQUILITY_URL="http://admin:password@localhost:5984/heroes/TRANQUILITY?rev=$TRANQUILITY_REV"
39+
BEATRIX_EMORY_URL="http://admin:password@localhost:5984/heroes/BEATRIX_EMORY?rev=$BEATRIX_EMORY_REV"
40+
INFERNO_FLARE_URL="http://admin:password@localhost:5984/heroes/INFERNO_FLARE?rev=$INFERNO_FLARE_REV"
4141

4242
# Check URLS
4343
echo $JOXOS_URL

couchdb/bash/read_DB.sh

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
# Get CouchDB Information
2-
echo "curl 'http://localhost:5984'"
3-
curl 'http://localhost:5984'
2+
echo "curl 'http://admin:password@localhost:5984'"
3+
curl 'http://admin:password@localhost:5984'
44

5-
echo "curl -X GET 'http://localhost:5984'"
6-
curl -X GET 'http://localhost:5984'
5+
echo "curl -X GET 'http://admin:password@localhost:5984'"
6+
curl -X GET 'http://admin:password@localhost:5984'
77

88
# Get All Server Databases
9-
echo "curl -X GET 'http://localhost:5984/_all_dbs'"
10-
curl -X GET 'http://localhost:5984/_all_dbs'
9+
echo "curl -X GET 'http://admin:password@localhost:5984/_all_dbs'"
10+
curl -X GET 'http://admin:password@localhost:5984/_all_dbs'
1111

1212
# Get Database Information
13-
echo "curl -X GET 'http://localhost:5984/heroes'"
14-
curl -X GET 'http://localhost:5984/heroes'
13+
echo "curl -X GET 'http://admin:password@localhost:5984/heroes'"
14+
curl -X GET 'http://admin:password@localhost:5984/heroes'
1515

16-
echo "curl -I HEAD 'http://localhost:5984/heroes'"
17-
curl -I HEAD 'http://localhost:5984/heroes'
16+
echo "curl -I HEAD 'http://admin:password@localhost:5984/heroes'"
17+
curl -I HEAD 'http://admin:password@localhost:5984/heroes'
1818

1919
# Get All Documents in Database
20-
echo "curl -X GET 'http://localhost:5984/heroes/_all_docs'"
21-
curl -X GET 'http://localhost:5984/heroes/_all_docs'
20+
echo "curl -X GET 'http://admin:password@localhost:5984/heroes/_all_docs'"
21+
curl -X GET 'http://admin:password@localhost:5984/heroes/_all_docs'
2222

2323
# Find All Documents that Satisfy Parameters
24-
echo "curl -H 'Content-Type:application/json' -X POST 'http://localhost:5984/heroes/_find' -d {JSON}"
25-
curl -H 'Content-Type:application/json' -X POST 'http://localhost:5984/heroes/_find' -d '{"selector": {"name": { "$gt": "0" }}, "fields": ["name", "health"], "limit": 20}'
24+
echo "curl -H 'Content-Type:application/json' -X POST 'http://admin:password@localhost:5984/heroes/_find' -d {JSON}"
25+
curl -H 'Content-Type:application/json' -X POST 'http://admin:password@localhost:5984/heroes/_find' -d '{"selector": {"name": { "$gt": "0" }}, "fields": ["name", "health"], "limit": 20}'
2626

2727
# Find All Document Changes
28-
echo "curl -X GET 'http://localhost:5984/heroes/_changes'"
29-
curl -X GET 'http://localhost:5984/heroes/_changes'
28+
echo "curl -X GET 'http://admin:password@localhost:5984/heroes/_changes'"
29+
curl -X GET 'http://admin:password@localhost:5984/heroes/_changes'

couchdb/bash/read_document_DB.sh

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
# Get Document Information
2-
curl -X GET 'http://localhost:5984/heroes/JOXOS'
3-
curl -X GET 'http://localhost:5984/heroes/VI'
4-
curl -X GET 'http://localhost:5984/heroes/ROKH_AEGIS'
5-
curl -X GET 'http://localhost:5984/heroes/TRANQUILITY'
6-
curl -X GET 'http://localhost:5984/heroes/BEATRIX_EMORY'
7-
curl -X GET 'http://localhost:5984/heroes/INFERNO_FLARE'
2+
curl -X GET 'http://admin:password@localhost:5984/heroes/JOXOS'
3+
curl -X GET 'http://admin:password@localhost:5984/heroes/VI'
4+
curl -X GET 'http://admin:password@localhost:5984/heroes/ROKH_AEGIS'
5+
curl -X GET 'http://admin:password@localhost:5984/heroes/TRANQUILITY'
6+
curl -X GET 'http://admin:password@localhost:5984/heroes/BEATRIX_EMORY'
7+
curl -X GET 'http://admin:password@localhost:5984/heroes/INFERNO_FLARE'
88

99
# Get Document Header Information
10-
curl -I HEAD 'http://localhost:5984/heroes/JOXOS'
11-
curl -I HEAD 'http://localhost:5984/heroes/VI'
12-
curl -I HEAD 'http://localhost:5984/heroes/ROKH_AEGIS'
13-
curl -I HEAD 'http://localhost:5984/heroes/TRANQUILITY'
14-
curl -I HEAD 'http://localhost:5984/heroes/BEATRIX_EMORY'
15-
curl -I HEAD 'http://localhost:5984/heroes/INFERNO_FLARE'
10+
curl -I 'http://admin:password@localhost:5984/heroes/JOXOS'
11+
curl -I 'http://admin:password@localhost:5984/heroes/VI'
12+
curl -I 'http://admin:password@localhost:5984/heroes/ROKH_AEGIS'
13+
curl -I 'http://admin:password@localhost:5984/heroes/TRANQUILITY'
14+
curl -I 'http://admin:password@localhost:5984/heroes/BEATRIX_EMORY'
15+
curl -I 'http://admin:password@localhost:5984/heroes/INFERNO_FLARE'
1616

1717
# Get Document List of Revisions
18-
curl -X GET 'http://localhost:5984/heroes/JOXOS?revs=true'
19-
curl -X GET 'http://localhost:5984/heroes/VI?revs=true'
20-
curl -X GET 'http://localhost:5984/heroes/ROKH_AEGIS?revs=true'
21-
curl -X GET 'http://localhost:5984/heroes/TRANQUILITY?revs=true'
22-
curl -X GET 'http://localhost:5984/heroes/BEATRIX_EMORY?revs=true'
23-
curl -X GET 'http://localhost:5984/heroes/INFERNO_FLARE?revs=true'
18+
curl -X GET 'http://admin:password@localhost:5984/heroes/JOXOS?revs=true'
19+
curl -X GET 'http://admin:password@localhost:5984/heroes/VI?revs=true'
20+
curl -X GET 'http://admin:password@localhost:5984/heroes/ROKH_AEGIS?revs=true'
21+
curl -X GET 'http://admin:password@localhost:5984/heroes/TRANQUILITY?revs=true'
22+
curl -X GET 'http://admin:password@localhost:5984/heroes/BEATRIX_EMORY?revs=true'
23+
curl -X GET 'http://admin:password@localhost:5984/heroes/INFERNO_FLARE?revs=true'
2424

2525
# Get Document Revision History
26-
curl -X GET 'http://localhost:5984/heroes/JOXOS?revs_info=true'
27-
curl -X GET 'http://localhost:5984/heroes/VI?revs_info=true'
28-
curl -X GET 'http://localhost:5984/heroes/ROKH_AEGIS?revs_info=true'
29-
curl -X GET 'http://localhost:5984/heroes/TRANQUILITY?revs_info=true'
30-
curl -X GET 'http://localhost:5984/heroes/BEATRIX_EMORY?revs_info=true'
31-
curl -X GET 'http://localhost:5984/heroes/INFERNO_FLARE?revs_info=true'
26+
curl -X GET 'http://admin:password@localhost:5984/heroes/JOXOS?revs_info=true'
27+
curl -X GET 'http://admin:password@localhost:5984/heroes/VI?revs_info=true'
28+
curl -X GET 'http://admin:password@localhost:5984/heroes/ROKH_AEGIS?revs_info=true'
29+
curl -X GET 'http://admin:password@localhost:5984/heroes/TRANQUILITY?revs_info=true'
30+
curl -X GET 'http://admin:password@localhost:5984/heroes/BEATRIX_EMORY?revs_info=true'
31+
curl -X GET 'http://admin:password@localhost:5984/heroes/INFERNO_FLARE?revs_info=true'

couchdb/bash/start_DB.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
mkdir /tmp/couchdb
2+
mkdir /tmp/couchdb/data
3+
14
# Start a CouchDB container with exposed port and bind mount
25
docker run -p 5984:5984 -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password --mount type=bind,source=/tmp/couchdb/data,target=/opt/couchdb/data -d --name my-couchdb couchdb:latest
36

couchdb/bash/update_document_DB.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ echo $BEATRIX_EMORY
1414
echo $INFERNO_FLARE
1515

1616
# Grab Latest Revision and Save to File
17-
curl -X GET 'http://localhost:5984/heroes/JOXOS?revs=true' | jq '._rev' > joxos_rev.txt
18-
curl -X GET 'http://localhost:5984/heroes/VI?revs=true' | jq '._rev' > vi_rev.txt
19-
curl -X GET 'http://localhost:5984/heroes/ROKH_AEGIS?revs=true' | jq '._rev' > rokh_aegis_rev.txt
20-
curl -X GET 'http://localhost:5984/heroes/TRANQUILITY?revs=true' | jq '._rev' > tranquility_rev.txt
21-
curl -X GET 'http://localhost:5984/heroes/BEATRIX_EMORY?revs=true' | jq '._rev' > beatrix_emory_rev.txt
22-
curl -X GET 'http://localhost:5984/heroes/INFERNO_FLARE?revs=true' | jq '._rev' > inferno_flare_rev.txt
17+
curl -X GET 'http://admin:password@localhost:5984/heroes/JOXOS?revs=true' | jq '._rev' > joxos_rev.txt
18+
curl -X GET 'http://admin:password@localhost:5984/heroes/VI?revs=true' | jq '._rev' > vi_rev.txt
19+
curl -X GET 'http://admin:password@localhost:5984/heroes/ROKH_AEGIS?revs=true' | jq '._rev' > rokh_aegis_rev.txt
20+
curl -X GET 'http://admin:password@localhost:5984/heroes/TRANQUILITY?revs=true' | jq '._rev' > tranquility_rev.txt
21+
curl -X GET 'http://admin:password@localhost:5984/heroes/BEATRIX_EMORY?revs=true' | jq '._rev' > beatrix_emory_rev.txt
22+
curl -X GET 'http://admin:password@localhost:5984/heroes/INFERNO_FLARE?revs=true' | jq '._rev' > inferno_flare_rev.txt
2323

2424
# Remove Qoutes from Revision
2525
sed 's/\"//g' joxos_rev.txt > joxos_rev_value.txt
@@ -45,12 +45,12 @@ echo $BEATRIX_EMORY_REV
4545
echo $INFERNO_FLARE_REV
4646

4747
# Combine Revision with URL
48-
JOXOS_URL="http://localhost:5984/heroes/JOXOS?rev=$JOXOS_REV"
49-
VI_URL="http://localhost:5984/heroes/VI?rev=$VI_REV"
50-
ROKH_AEGIS_URL="http://localhost:5984/heroes/ROKH_AEGIS?rev=$ROKH_AEGIS_REV"
51-
TRANQUILITY_URL="http://localhost:5984/heroes/TRANQUILITY?rev=$TRANQUILITY_REV"
52-
BEATRIX_EMORY_URL="http://localhost:5984/heroes/BEATRIX_EMORY?rev=$BEATRIX_EMORY_REV"
53-
INFERNO_FLARE_URL="http://localhost:5984/heroes/INFERNO_FLARE?rev=$INFERNO_FLARE_REV"
48+
JOXOS_URL="http://admin:password@localhost:5984/heroes/JOXOS?rev=$JOXOS_REV"
49+
VI_URL="http://admin:password@localhost:5984/heroes/VI?rev=$VI_REV"
50+
ROKH_AEGIS_URL="http://admin:password@localhost:5984/heroes/ROKH_AEGIS?rev=$ROKH_AEGIS_REV"
51+
TRANQUILITY_URL="http://admin:password@localhost:5984/heroes/TRANQUILITY?rev=$TRANQUILITY_REV"
52+
BEATRIX_EMORY_URL="http://admin:password@localhost:5984/heroes/BEATRIX_EMORY?rev=$BEATRIX_EMORY_REV"
53+
INFERNO_FLARE_URL="http://admin:password@localhost:5984/heroes/INFERNO_FLARE?rev=$INFERNO_FLARE_REV"
5454

5555
# Check URLS
5656
echo $JOXOS_URL

0 commit comments

Comments
 (0)