Skip to content

FatmaSedaOZYURT/AspNetMicroservices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AspNetMicroservices

AspNetMicroservices

🛸 MongoDB in Docker

  • To Download

    > docker pull rtsp/mongosh

  • To Run For Local PC Port

    >docker run -d -p [portNumber]:[portNumber] --name [containerName] [imageName]

    >docker run -d -p 27017:27017 --name shopping-mongo rtsp/mongosh

  • To See Logs

    > docker logs -f shopping-mongo

  • Interactive Terminal - Bash Command

    > docker exec -it shopping-mongo /bin/bash


    If bash is not have, should run this codes:

    apt-get update

    apt-get install -y mongodb


    *OR*

    docker exec -it shopping-mongo mongosh


  • Create DB

    > mongo

    > use CatalogDb

    To create collection: > db.createCollection('Products')

    To Add Data:

    db.Products.insertMany([{'Name':'Asus Laptop','Category':'Computers', 'Summary':'Summary', 'Description':'Description', 'ImageFile':'ImageFile', 'Price':54.56},{'Name':'HP Laptop','Category':'Computers', 'Summary':'Summary', 'Description':'Description', 'ImageFile':'ImageFile', 'Price':66.56}])

    To list data: > db.Products.find({}).pretty()

    To delete datas: > db.Products.remove({})

  • To Show DB: >show databases

    To Show Collections: >show collections

About

AspNetMicroservices

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages