different between concurrency and parallelism

concurrent-parallel-sequencial

ref : https://medium.com/hbot/concurrency-กับ-parallelism-ต่างกันยังไง-17dc15ff90f6

Advertisements

[ mongodb ] mongoexport

mongoexport –db test –collection traffic –out traffic.json

 

–host <hostname><:port>

–username

–password

–query “<json>”

–fields “_id._p,value.count”

 

example

mongoexport --host localhost:27017 --username mydbuser --password mydbsecret --db test --collection user --fields "email,updated_at" --query '{"updated_at": {"$gte": ISODate("2017-08-29T09:10:05.280Z")}}' --out user.json

 

export from all shard

ref : https://www.codejuggle.dj/how-to-backup-and-restore-a-mongodb-sharded-cluster/

[ GoLang ] underscore function

underscore ( _ ) avoids having to declare all the variables for the returns values.

Example

changeInfo, err := c.RemoveAll(query)

This will cause the compile error

$ go build mongo_connect.go
# command-line-arguments
./mongo_connect.go:104: changeInfo declared and not used

So, change it to underscore.

_, err := c.RemoveAll(query)

ref : https://stackoverflow.com/questions/27764421/what-is-in-a-golang-declaration