fix issue with querying documents by attributes
added specs for querying documents by attributes