Mongo DB Compass woes

Can some kind person show me a working example of inserting data from a JSON file into a MongoDB…?

Cos no mattter what I try my JSON file is rejected

here is my JSON file which https://jsonlint.com/ says is valid JSON


{	"accounts": [{
		"accountName": "account_1",
		"keys": [
			"ab7cb05bbb42c8e5d095dd98d04e65de72bbad5a05e2bc723f0aff4da24683c34547aacfcdc3e9027152849730d4d1fb",
			"3b4a9bf975c5f1a0bb32001fcffd3490aaa8ca4c546723a0c8069eeec55728a2"
		],
		"Wallet": "safe://hyryynyty9bwsziz39h7y53uqgtsguo3hdo5yeg3ruag635tfkdg8hh3ejab6o"
	}, {
		"accountName": "account_2",
		"keys": [
			"9142b600579d95d7ef99a3e3f631f133e7b3a1ae98869583e76cd3dd71f2e40ce5416d474be34e3aceb2babcf0a4bd07",
			"57e7f5c054f579b758b58ddb30e1af56e17d19aef4683d153d81783786ce5ab9"
		],
		"Wallet": "safe://hyryynywcrunfuk6xutkxefxx9rd9xqh6oik6q79cbwt5bt79ysg88zufxwb6o"
	}, {
		"accountName": "account_3",
		"keys": [
			"b91d400767dd0b10c814ade3be85da4491a24b18427f52325aed0cd8b063ce697081d2a3d7e742456be85513cc3c42ca",
			"300bd270c8623834084dafca982486efbdfc0ad7367f22a918e638739a4f2033"
		],
		"Wallet": "safe://hyryynytwhzwh6baaumrhs4s3kthc7hzee8usefxtfmjx7h9yyqh5bu814rb6o"
	}, {
		"accountName": "account_4",
		"keys": [
			"83cb957d1613669c82f5db362cc28ea6f01d7d335e9385cef9f79e763b93bcc5d4e0da55cf1a5ea5af1ab6d7e8f2e7b2",
			"4f9134fe856b522f969dc39e3956f174826f0bdd6f6674da5e3f111e30dd4c62"
		],
		"Wallet": "safe://hyryynyu199gymtue64hoc9qdtdngc8qxgio158i59odd7w6g9j1n6gmxbrb6o"
	}, {
		"accountName": "account_5",
		"keys": [
			"b51c7d7fdeb6fe9cf9553735add421ce64d7c3e1b770625d3581717d8f5b808896909a979094de1580480ba7b3cdae85",
			"236b7967717a7b131948971613c00426a6e040d290a34d246ed4d6b8838912f0"
		],
		"Wallet": "safe://hyryyny1cpdi6t4oxx4ehfz6ymfwwjmts8ijrjbz5ecu3ue7psexhh8w4kwb6o"
	}, {
		"accountName": "account_6",
		"keys": [
			"a4a248e3e45fb3b471e5c5106928387b18695e8fd1725cca6ca25fe683eed75704ce92d2522e9f7f0ace97a98a288c38",
			"61bf30936e56bcd22b5bf42c455e852b82ca68b89c1e7a288bdd815f349a562d"
		],
		"Wallet": "safe://hyryynyo9hc9ikr8yetaijjsym5by7aun9pg4toucganzzx8946ohihbw5yb6o"
	}, {
		"accountName": "account_7",
		"keys": [
			"86a7f20e7872df6c2549a92f13e86221d95c3fd5254ed21677a0e60bea58f05a478767687673d8d2c2e1b1da651928fa",
			"3cb087ab8fb22b8514f8dedd67d91bc399e53b22044e93adf35651eb6f39d5cd"
		],
		"Wallet": "safe://hyryynyonidwkxb3g6kqjdo6iujtsnf8dgo4ntjsw8gabu14kghw5a13nkrb6o"
	}, {
		"accountName": "account_8",
		"keys": [
			"ae0d9dc17aca6953e94afb3be3c7bcbaa5d8abc23ff6dcf9a65b57b783a119e39924ed9e99000275ba0658f7e24b4e90",
			"28e77ac5c506c53fa358afad56fcef9b2a4464a6f31dd2c685d724e912c01b71"
		],
		"Wallet": "safe://hyryynyseetqic3fg1qx1sqspjmupf6do6tyb774now61dp9td59fkg1eycb6o"
	}, {
		"accountName": "account_9",
		"keys": [
			"8728bbda7d1c8dc224998425302c87c6f95c7bc85fa2de1d23edabedc384d2abc654b4c5c68b9d90a5176fcacfafa5f4",
			"72dda2f58dbe1f6dc31d71701b752594c8e4e81774c001f2775af417d842f617"
		],
		"Wallet": "safe://hyryynytdzexcahw1bztcsobs7dot1xxgzpb1kesppzn9c59us914k44jecb6o"
	}, {
		"accountName": "account_10",
		"keys": [
			"abb74736677c5fce5929b796345ee49ece40bf0b4a8bad9ccfb8d8e3420a74326a2f457ad22bba1cc58f2c9a5fb15def",
			"061b4c18e8a401d75c389a88334ab073fca7d086d9b149edf124c1d5219bcdfe"
		],
		"Wallet": "safe://hyryynywpt4xrdbb6jk896c8sjqp8n8knornnonr6j7ssnsjp87fwouabzcb6o"
	}, {
		"accountName": "account_11",
		"keys": [
			"83e1d922c1a5569fa362a374018ee717d6a56ab7517dfebec501d6cec76e7233a8f134c1323717f699879bd34bc333fb",
			"12a8c7861c3407dfa5c7da6e6d2e462a610cbc16b825415b765985e5b214193e"
		],
		"Wallet": "safe://hyryynyz98fd3pxw8p41zz7k63er3fkddofocqi9x6ch3rnksc75naku86ab6o"
	}, {
		"accountName": "account_12",
		"keys": [
			"ad6287a84efdd2e87aff4a39b8075b7d4d49cb741417546cc9315d1f8f3759a10586e085e4c393e2e4279a3a371bd219",
			"04ba57134c34a299701578784355408b9f793a8a1cb70e007ac25925dec783ab"
		],
		"Wallet": "safe://hyryynyw4mer46d7k1r8crobocipocx4wkrz8rcqr555iyawfcup6wn69xwb6o"
	}]
}
2 Likes

I also found errors when importing with json. No idea why…
But seems if you click ADD DATA > Insert Document and paste the json code there it works fine.

1 Like

I admitted defeat and converted to csv :slight_smile:

I tried ADD DATA and saw similar to your screenshot but when I try to access the records I pasted all I get is the ObjectId instead of 500 other account records(documents)

Same result if I start a new collection and ADD DATA there.

1 Like

This topic was automatically closed after 60 days. New replies are no longer allowed.