class MongoDbPageRepository implements PageRepository {

    @Override
    public int deletePages(String userId, String pageType) {
        Query query = query(where("pageType").is(pageType).andOperator(where("ownerId").is(userId)));
        int count = (int)template.count(query);
        template.remove(query);
        return count;
    }

}