bastman / spring-kotlin-mongodb

a simple playground for kotlin + spring + mongo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

spring-kotlin-mongodb

poc: a simple playground for kotlin, spring-boot, spring-data-mongo, docker, docker-compose

findings: spring-data

repo.insert

works as expected

  • repo.insert(id="a"): inserted
  • repo.insert(id="a"): DuplicateKeyException

repo.update

does not(!) work as expected repo.save() -> does an UPSERT !

  • repo.insert(id="a"): inserted
  • repo.save(id="a"): updated
  • repo.save(id="b"): inserted

runbook

playground

    # build db + app and start everything using docker-compose
       
    $ make -C rest-api playground.up
    $ open http://localhost:8080/swagger-ui.html

build

    $ make -C rest-api help
    $ make -C rest-api app.build

build + test

    $ make -C rest-api help
    $ make -C rest-api app.test
    
    # serve test reports ...
    $ make -C rest-api reports.serve.tests
    $ open http://127.0.0.1:20000
    

run local db (docker)

    # db-local
    
    # start
    $ make -C rest-api db-local.up
    # stop
    $ make -C rest-api db-local.down
    # stop and remove volumes
    $ make -C rest-api db-local.down.v
            
    # db-ci (to be used for gradle test)
    
    # start
    $ make -C rest-api db-ci.up
    # stop db and remove volumes
    $ make -C rest-api db-ci.down.v

inspired by

tools

Alt text

About

a simple playground for kotlin + spring + mongo


Languages

Language:Kotlin 84.9%Language:Makefile 14.3%Language:Dockerfile 0.5%Language:Shell 0.3%