Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wendreof/nodemultipledbs
https://github.com/wendreof/nodemultipledbs
adminer mongoclient mongodb nodejs nosql postgresql sql
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/wendreof/nodemultipledbs
- Owner: wendreof
- Created: 2019-07-20T19:58:04.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T18:18:51.000Z (almost 2 years ago)
- Last Synced: 2023-03-07T19:58:46.380Z (almost 2 years ago)
- Topics: adminer, mongoclient, mongodb, nodejs, nosql, postgresql, sql
- Language: JavaScript
- Size: 696 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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'})