【개인 메모】tiedot이라는 NoSQL DB를 만나보세요
tiedot?
tiedot
Go로 작성된 NoSQL DB.
만져 보는 메모를 적어 라.
환경
설치 방법
> go get github.com/HouzuoGuo/tiedot
tiedot 시작
> tiedot -mode=httpd -dir=/tmp/MyDatabase -port=8080
tiedot 웹 UI
웹 UI가 준비되어 있다. admin 화면을 열어보세요
> open http://localhost:8080/admin

웹 UI에서 작업하기
컬렉션과 하야를 만들어 보자.

"New Collection"버튼을 클릭하고,
Modal 안에 콜렉션명을 넣어 작성해 보았다.

문서 만들기
> go get github.com/HouzuoGuo/tiedot
> tiedot -mode=httpd -dir=/tmp/MyDatabase -port=8080
tiedot 웹 UI
웹 UI가 준비되어 있다. admin 화면을 열어보세요
> open http://localhost:8080/admin

웹 UI에서 작업하기
컬렉션과 하야를 만들어 보자.

"New Collection"버튼을 클릭하고,
Modal 안에 콜렉션명을 넣어 작성해 보았다.

문서 만들기
> open http://localhost:8080/admin




검색하기 위해 색인 설정
쿼리를 던지려면 index를 설정해야하기 때문에,
index를 설정한다.

"New Index"버튼을 누릅니다.


문서로 저장했을 때 사용한 키 이름입니다.
age, name, gadgets를 입력하십시오.

문서에 저장된 값을 GUI로 가져옵니다.
name=Keiji Matsuzaki가 되는 문서가 없는지 검색하는 쿼리를 GUI에서 발행한다

검색 대상이 되는 문서는 1건 밖에 저장하고 있지 않지만,
쿼리를 작성하기로 결정
{ "eq": "Keiji Matsuzaki", "in": ["name"]}

"Execute"버튼을 눌러 검색어에 맞는 문서가 있으면,
문서가 표시됩니다.
검색에 걸리지 않는 쿼리를 발행했을 경우는, 문서는 나오지 않는다.

CLI에서 작업
tiedot에는 CLI에서도 조작이 가능하게 되도록 API가 준비되어 있다.
자세한 내용은 API reference and embedded usage을 참조하십시오.
컬렉션 만들기
> curl "http://localhost:8080/create?col=hogehoge"
컬렉션이 만들어졌는지 확인
> curl "http://localhost:8080/all"
["hogehoge"]
문서를 컬렉션에 대해 만들기
> curl --data-ascii \
doc='{"name": "Keiji Matsuzaki", "age": 32, "gadgets": ["iPhone 6 Plus", "Nexus 7", "Mac Book Pro Retina Late 2012"]} \
'http://localhost:8080/insert?col=hogehoge'
1652584854220917731
돌아온 ID를 바탕으로 문서 검색
고유 ID가 생성되므로 검색이 용이합니다.
> curl "http://localhost:8080/get?col=hogheoge&id=1652584854220917731"
{"age":32,"gadgets":["iPhone 6 Plus","Nexus 7","Mac Book Pro Retina Late 2012"],"name":"Keiji Matsuzaki"}
검색어 던지기
색인 만들기
index를 만들지 않으면 쿼리를 던질 수 없다.
age, name, gadgets index 만들기
> curl "http://localhost:8080/index?col=hogehoge&path=age"
> curl "http://localhost:8080/index?col=hogehoge&path=name"
> curl "http://localhost:8080/index?col=hogehoge&path=gadgets"
쿼리를 던지다
> curl "http://localhost:8080/create?col=hogehoge"
> curl "http://localhost:8080/all"
["hogehoge"]
> curl --data-ascii \
doc='{"name": "Keiji Matsuzaki", "age": 32, "gadgets": ["iPhone 6 Plus", "Nexus 7", "Mac Book Pro Retina Late 2012"]} \
'http://localhost:8080/insert?col=hogehoge'
1652584854220917731
> curl "http://localhost:8080/get?col=hogheoge&id=1652584854220917731"
{"age":32,"gadgets":["iPhone 6 Plus","Nexus 7","Mac Book Pro Retina Late 2012"],"name":"Keiji Matsuzaki"}
> curl "http://localhost:8080/index?col=hogehoge&path=age"
> curl "http://localhost:8080/index?col=hogehoge&path=name"
> curl "http://localhost:8080/index?col=hogehoge&path=gadgets"
> curl --data-ascii \
doc='{"name": "Keiji Matsuzaki", "in": ["name"]}' \
http://localhost:8080/query?col=hogehoge'
{"1652584854220917731":{"age":32,"gadgets":["iPhone 6 Plus","Nexus 7","Mac Book Pro Retina Late 2012"],"name":"Keiji Matsuzaki"}}
서버 종료
> curl "http://localhost:8080/shutdown"
curl: (52) Empty reply from server
만져보세요
CouchDB의 대안이 될 것인가, 문득 생각하거나 ...
개발시 JSON에서 응답을 반환하는 API 서버 모형으로 사용할 수 있지 않을까.
Reference
이 문제에 관하여(【개인 메모】tiedot이라는 NoSQL DB를 만나보세요), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/futoase/items/b5cfe9419f5d8a454d56
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
Reference
이 문제에 관하여(【개인 메모】tiedot이라는 NoSQL DB를 만나보세요), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/futoase/items/b5cfe9419f5d8a454d56텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)