Table of Contents

Mongodb

mongo sh

mongosh -u root -p gudab

dump data

mongodump --authenticationDatabase admin -u root -p gudab -d hnb-systalk-flow --collection=nodemessages -o .

restore data (--drop for drop collection first)

mongorestore --authenticationDatabase admin -u root -p gudab -d hnb-systalk-flow --collection=nodemessages hnb-systalk-flow/nodemessages.bson

bson to json and import

transform from bson to json

bsondump hnb-systalk-flow/nodemessages.bson > hnb-systalk-flow/nodemessages.json

json truncate _id

jq 'del(._id)' hnb-systalk-flow/nodemessages.json > hnb-systalk-flow/nodemessages2.json

json import

mongoimport --authenticationDatabase admin -u root -p gudab -d hnb-systalk-flow --collection=nodemessages --file=./hnb-systalk-flow/nodemessages2.json