-
-
Notifications
You must be signed in to change notification settings - Fork 188
Description
I've seen one-off implementations - and built one of my own - to solve a common problem:
Create an collection where missing parent collections will be created.
On the linux command line this is possible by setting the -p flag on mkdir.
mkdir -p `/this/is/a/deeply/nested/directory`
nodeJS for example mimics this behaviour by setting the recursive option on the builtin fs.mkdir method.
There is no such facility present in eXistdb to my knowledge. That is why I propose to add that by either
- a new function
xmldb:create-collection-recursiveaccepting one parameter:
- collectionUri as xs:string
- or add a signature to
xmldb:create-collectionaccepting two parameters:
- collectionUri as xs:string
- options as xs:map
- create a new builtin XQuery module that will handle this and all other collection operations. This module would then deprecate
currently available functionsxmldb:create-collection,xmldb:collection-availableand the like. While this is definitely a controversial proposal it also has the potential to rethink our current approach while maintaining backwards compatibility.
The fact that xmldb:create-collection already has a two parameter signature does rule out option 2 unless we choose to also
introduce a breaking change. The current xmldb:create-collection#2 would have to be changed to
xmldb:create-collection($collectionUri as xs:string) as xs:string removing the parent collection parameter that is currently expected.
I personally favor having the collection URIs to be in one parameter but certainly am open to discuss the motivation behind the current implementation.