Reputation: 517
How to find out when a document was added to a specified collection? Reversely how to find when the first document was added into a collection? If that is possible what would be an efficient way of listing all documents added to a particular collection in a specified time range?
Upvotes: 0
Views: 71
Reputation: 7840
Not possible: the database simply doesn't store timestamps for changes to document collections in any useful way. Also keep in mind that collections don't exist on their own. They're more like tags that are attached to documents. Calling fn:collection($uri)
returns all the documents tagged with the collection $uri
.
So collections aren't much different than XML elements. We could also query the database for //my-collection[. eq $uri]
. Add an xs:dateTime
attribute to that same element and you can use that to track changes. You'll have to write code to maintain that timestamp yourself. For range lookups you could configure an element-attribute range index.
Upvotes: 1