- From: Hans-Juergen Rennau <hrennau@yahoo.de>
- Date: Sun, 8 Mar 2015 22:46:17 +0000 (UTC)
- To: "christian.gruen@gmail.com" <christian.gruen@gmail.com>
- Cc: "public-expath@w3.org" <public-expath@w3.org>, "expath@googlegroups.com" <expath@googlegroups.com>, "dannes@exist-db.org" <dannes@exist-db.org>
- Message-ID: <675653562.1234022.1425854777652.JavaMail.yahoo@mail.yahoo.com>
Hi Christian, I would like to make a few suggestions concerning the new MongoDB module: one major, several minor. index management=============== First of all, I feel we need two functions for creating and dropping indexes, something similar to this: mongodb:createIndex($client-id as xs:string, $database as xs:string, $collection as xs:string, $indexDescriptor as map(*), $options as map(*)) as map(*) mongodb:dropIndex($client-id as xs:string, $database as xs:string, $collection as xs:string, $indexDescriptor as map(*)) as map(*) [The returned map is meant to report the success.] Of course, an index info function would also be useful, like this:mongodb:getIndexes($client-id as xs:string, $database as xs:string, $collection as xs:string) as map(*) mongodb:update / return value ========================When an 'update' call uses the "upsert" option, it may create a new document whose _id should be returned. Therefore I suggest that the return value of mongodb:update should not be empty-sequence(), but either xs:string? or, better, a map containing the values supplied by the 'WriteResult' object when using the mongo shell, for instance:WriteResult({ "nMatched" : 25, "nUpserted" : 0, "nModified" : 24 }) mongodb:find / options ==================The spec says about "fields": "Restricts the returned fields. The file _id will always be returned." However, supposing that the XQuery function is equivalent to db.collection.find(), the _id field can be suppressed by the "fields" entry "_id: 0", which can be combined with inclusive and exclusive field selection, alike. I suppose this issue concerns only the spec text, not the intended functionality? ~ ~ ~ Finally an editorial suggestion. Later, the spec might perhaps for each mongodb function specify the equivalence of functionality provided by the function on one hand, and a well-defined MongoDB operation on the other hand: for example the equivalence between mongodb:find and db.collection.find, including the alignment of function parameters and operation parameters. Having established such an equivalence, the normative semantics could be reduced to "providing the result/effect one would have obtained/produced by using the equivalent MongoDB operation"; of course the spec should continue to provide a brief description, but it would be non-normative. Cheers,Hans-Jürgen
Received on Sunday, 8 March 2015 22:46:47 UTC