MODE-1853 - Updated the code so that "unwrap" is called in more places, trying to avoid the risk of Document & Array editors being passed in.
MODE-1853 - Reverted the changes to SchematicDB as per review and added a minor fix so that the code makes sense.