Re: [expath] MongoDB Module: maps → strings?

))

Basically instead of using a map of key-value pairs (which is just a
function from key->value), you use an array/sequence (which is
ordered) of functions which return key->value pairs. You could model
this in several different ways, for example another way would be:

mongo:command($id, 'db', function() {
  array {
     ('createIndexes', 'indexes'),
     function($key as xs:string) {
        switch($key) {
          case 'createIndexes':
              'coll'
          case 'indexes':
              ...
        }
     }
  }
})

I would abstract this structural pattern and provide functions to help
create it, as you will be nesting this to be able to create
effectively ordered maps of maps.

Although.... it might just be easier to use XML! :-)

Received on Monday, 30 March 2015 08:21:37 UTC