Improve handling of collection names in generated JS

1. Generate correct mongo shell syntax for collections with names that aren't valid dot-separated JS identifiers.
2. Change generated names for temporary collections so that they are valid dot-separated JS identifiers, and to put them all under a `tmp` pseudo-namespace (so that they appear in the API as sharing a `tmp/` sub-directory.

This is another extract from my WIP branch for #140.
Hmm. I see the logic, but that would involve some more widespread changes. For one thing, the planner would have to have to receive the destination path as a second parameter along with the logical plan. I don't think I want to go down that path at this moment unless I have to.