When I developed the Foswiki MongoDB integration, I worked out a really ‘nifty’ way to do cross database and collection JOINs .
but, it’s finally been broken in MongoDB 2.2 – with the removal of the global lock.
So we’re going to have to restrict the foswiki MongoDB plugin to version 2.0.
So, you’re curious?
On reason I decided to use MongoDB as a target for foswiki adhoc queries, was the backup of writing $where clauses in javascript. I’ve used them when the Perl-isms in foswiki’s query results could not be magically matched – string and number duplicity for example.
and one facility that MongoDB’s javascript has, is to call db.getSisterDB(‘someotherdbname’);
so for (a very simplified) example:
db.current.find({$where : "db.getSisterDB(this.otherDB).current.findOne({topic: this.otherTopic}).value == 'what are you looking at'"});
yes, this is not SELECT JOIN, just WHERE JOIN – but it’s exactly what we needed.