GithubHelp home page GithubHelp logo

nodemultipledbs's Introduction

after starting all containers below

#run test and UP SERVER on port 5000 sudo yarn test

#postgres sudo docker run
--name postgres5
-e POSTGRES_USER=wlf
-e POSTGRES_PASSWORD=password
-e POSTGRES_DB=heroes
-p 5432:5432
-d
postgres

#adminer docker run
--name adminer1
-p 8080:8080
--link postgres5:postgres5
-d
adminer

#mongodb
docker run
--name mongodb
-p 27017:27017
-e MONGO_INITDB_ROOT_USERNAME=admin
-e MONGO_INITDB_ROOT_PASSWORD=admin
-d
mongo:4

#mongoclient
docker run
--name mongoclient
-p 3000:3000
--link mongodb:mongodb
-d
mongoclient/mongoclient

#result
docker ps docker exec -it postgres /bin/bash

#others docker exec -it mongodb
mongo --host localhost -u admin -p admin --authenticationDatabase admin
--eval "db.getSiblingDB('herois').createUser({user: 'wlf', pwd: 'wlf', roles: [{role: 'readWrite', db: 'herois'}]})"

docker exec -it 2199279585d1
mongo -u wlf -p wlf --authenticationDatabase herois

show dbs
use herois
show collections

db.herois.insert({
nome: 'Flash',
poder: 'Velocidade',
dataNascimento: '1998-01-01'
})

for(let i=0; i<=10000; i++){
  db.herois.insert({
    nome: `Clone-${i}`,
    poder: 'Velocidade',
    dataNascimento: '1998-01-01'
    })
}

db.herois.count()
db.herois.findOne()
db.herois.find().limit(1000).sort({nome: -1})
db.herois.find({}, {poder:1, _id: 0})

//create
     db.herois.insert({
        nome: `Clone-${i}`,
        poder: 'Velocidade',
        dataNascimento: '1998-01-01'
        })
        
//read
db.herois.find()

//update
db.herois.update({ _id: ObjectId('5d3bc0a5aeecfcf8f486dc22') },
        {nome: 'Mulher Maravilha'})
db.herois.update({ _id: ObjectId('5d3bc168aeecfcf8f4870323') },
                            {$set: {nome: 'Lanterna Verde'} })
                            
//delete
db.herois.remove({nome: 'Lanterna Verde'})

nodemultipledbs's People

Stargazers

 avatar  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.