Skip to content

Instantly share code, notes, and snippets.

@sarjarapu
Created January 23, 2020 14:53
Show Gist options
  • Save sarjarapu/d57cf7d7a5dc706dbe0e1c0c779cc5e4 to your computer and use it in GitHub Desktop.
Save sarjarapu/d57cf7d7a5dc706dbe0e1c0c779cc5e4 to your computer and use it in GitHub Desktop.
A bash script to create LOCAL_KEY and start the MongoDB shell
# Generate 96 char local key. save it don't loose it
LOCAL_KEY=$(openssl rand -hex 50 | head -c 96 | base64 | tr -d '\n')
echo $LOCAL_KEY
# YzRiY2Y3ZGUzNDgxYzQwNzliMGEzMDI2YjU0ODkwMjQ5ZTNmMWFkZDdiZGUzMDc5ZTVlMWYxNjBlMDM5MGJmMjhmOWIyODdlMjU3MjA1M2ZmZjdiZDViYWE1Y2Q1OTRi
# Start the v4.2 client. Note that you are not connecting to server yet
${MONGO_BIN}/mongo --shell --nodb --eval "var LOCAL_KEY = '$LOCAL_KEY' "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment