GithubHelp home page GithubHelp logo

demo-app-mongo's Introduction

docker network create -d bridge my-net

docker run -d
-p 27017:27017
--name my-mongodb
--restart always
--network my-net
-e MONGO_INITDB_ROOT_USERNAME='admin' -e MONGO_INITDB_ROOT_PASSWORD='password' -v /usr/local/mongodata:/data/mongodb
mongo:4.4.10

mongosh mongodb://admin:[email protected]:27017/admin use admin db.auth('admin', 'password') db.createUser({ user: "demo",pwd: "demo", roles:[{role: "dbOwner", db:"demo"}]})

mongosh mongodb://demo:[email protected]:27017/demo

curl https://raw.githubusercontent.com/redis/redis/6.2/redis.conf -o /data/redis/etc/redis.conf

docker run -d
-p 6379:6379
--name my-redis
--restart always
--network my-net
-v /data/redis/etc:/usr/local/etc/redis
-v /data/redis/data:/data
-v /etc/localtime:/etc/localtime:ro
redis:6.0
redis-server --appendonly yes

redis-cli -h 127.0.0.1 -p 6379

docker build --network=my-net -t demo-app:v1 . yes|docker image prune

docker run -d
-p 8000:8000
--name demo-app
--restart always
--network my-net
demo-app:v1

mongoimport --uri=mongodb://demo:[email protected]:27017/demo?authSource=admin -c user --file /data/workspace/demo-app/common/userData.json --jsonArray --drop mongoimport --uri=mongodb://demo:[email protected]:27017/demo?authSource=admin -c team --file /data/workspace/demo-app/common/teamData.json --jsonArray --drop mongoimport --uri=mongodb://demo:[email protected]:27017/demo?authSource=admin -c role --file /data/workspace/demo-app/common/roleData.json --jsonArray --drop mongoimport --uri=mongodb://demo:[email protected]:27017/demo?authSource=admin -c route --file /data/workspace/demo-app/common/routeData.json --jsonArray --drop

docker run -d --name mongo-express --network my-net -e ME_CONFIG_MONGODB_ADMINUSERNAME='admin' -e ME_CONFIG_MONGODB_ADMINPASSWORD='password' -e ME_CONFIG_MONGODB_SERVER='my-mongodb' -p 8081:8081 mongo-express:latest docker run -d --name redisinsight --network my-net redis -p 8001:8001 redislabs/redisinsight

db.user.aggregate([ { $match: { "id": "c9163c5gfvm2hkhv1hhg" } }, { $lookup: { from: "role", localField: "id", foreignField: "user_id", as: "role" } } ]).pretty()

db.user.aggregate([ { $match: { "id": "c9163c5gfvm2hkhv1hhg" } }, { $lookup: { from: "role", localField: "id", foreignField: "user_id", as: "role" } }, { $unwind : "$role" } ]).pretty()

https://www.mongodb.com/docs/v4.4/reference/operator/aggregation/lookup/ https://www.docs4dev.com/docs/zh/mongodb/v3.6/reference/reference-operator-aggregation-pipeline.html

demo-app-mongo's People

Contributors

liujitao avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.