From Postgres
[{"Isbn":"978-1505255607","Title":"The Time Machine","Author":"H. G. Wells","Price":5.99},{"Isbn":"978-1503261960","Title":"Wind Sand \u0026 Stars","Author":"Antoine","Price":14.99},{"Isbn":"978-1503261961","Title":"West With The Night","Author":"Beryl Markham","Price":14.99}]
notice \u0026
That is valid JSON encoding. That is the unicode escape. & doesn't have to be encoded, but Go does this so we can just let it be. JSON encoders / decoders know how to deal with it.
Setup
-
Login as the Admin of your mongo db as in User & Permission Commands article
-
Create the user
use bookstore
db.createUser(
{
user: "bond",
pwd: "password",
roles: [ { role: "readWrite", db: "bookstore" } ]
}
)
exit
- Login as the user
mongo -u "bond" -p "password" --authenticationDatabase "bookstore"
use bookstore
db.books.insert([{"Isbn":"978-1505255607","Title":"The Time Machine","Author":"H. G. Wells","Price":5.99},{"Isbn":"978-1503261960","Title":"Wind Sand \u0026 Stars","Author":"Antoine","Price":14.99},{"Isbn":"978-1503261961","Title":"West With The Night","Author":"Beryl Markham","Price":14.99}])