Dump Mongo Collection into JSON format

Mongo includes a mongoexport utility (see docs) which can dump a collection. This utility uses the native libmongoclient and is likely the fastest method. mongoexport -d <database> -c <collection_name> Also helpful: -o: write the output to file, otherwise standard output is used (docs) –jsonArray: generates a valid json document, instead of one json object per … Read more

How in H2DB get sql dump like in MySql?

Yes, there are multiple solutions. One is to run the SCRIPT SQL statement: SCRIPT TO ‘fileName’ Another is to use the Script tool: java org.h2.tools.Script -url <url> -user <user> -password <password> Then, there are also the RUNSCRIPT statement and RunScript tool. By the way, you should consider upgrading to a more recent version of H2. … Read more

Dumping whole array: console.log and console.dir output “… NUM more items]”

Setting maxArrayLength There are a few methods all of which require setting maxArrayLength which otherwise defaults to 100. Provide the override as an option to console.dir console.dir(myArry, {‘maxArrayLength’: null}); Set util.inspect.defaultOptions.maxArrayLength = null; which will impact all calls to console.log and util.format Call util.inspect yourself with options. const util = require(‘util’) console.log(util.inspect(array, { maxArrayLength: null … Read more

Dumping a java object’s properties

You could try XStream. XStream xstream = new XStream(new Sun14ReflectionProvider( new FieldDictionary(new ImmutableFieldKeySorter())), new DomDriver(“utf-8”)); System.out.println(xstream.toXML(new Outer())); prints out: <foo.ToString_-Outer> <intValue>5</intValue> <innerValue> <stringValue>foo</stringValue> </innerValue> </foo.ToString_-Outer> You could also output in JSON And be careful of circular references šŸ˜‰

Migrate from Oracle to MySQL

Oracle does not supply an out-of-the-box unload utility. Keep in mind without comprehensive info about your environment (oracle version? server platform? how much data? what datatypes?) everything here is YMMV and you would want to give it a go on your system for performance and timing. My points 1-3 are just generic data movement ideas. … Read more