I have a very particular query. Assume that I have a doc say "myDoc", and this has 5 versions, now if I apply a new aspect to this doc, to which version it wil be applied? My guess would be to the latest version, but I don't see it working that way. How can I check "hasAspect()" in code for a versioned document?
Any modifications made to a document will always happen to the current or latest version. This includes adding an aspect which will be applied to the latest version.
There are a number of ways to check whether a particular document has an aspect applied. Perhaps the easiest it to navigate to the admin console in the Explorer client and select the Node Browser. This will allow you to browse through all the stores and nodes in the repository and see all the properties, aspects and associations that are attached to each node.