title: Dealing with non-spring data documents in couchbase
body: <p>Is there a recommended way to go about dealing with documents that don't have the <code>_class</code> field with spring-data-couchbase( if there is one)?  Trying it simply just throws an exception as expected.</p>
  
  <p>Edit: Apologies if this was a bit too vague, let me add a bit more context. 
  I want to fetch data from couchbase for some student by name, let's say . The repository looks something like -</p>
  
  <p>@Repository</p>
  
  <p>public interface StudentRepository extends CouchbaseRepository {</p>
  
  <pre><code>Optional&lt;StudentDocument&gt; findByName(String name);
  </code></pre>
  
  <p>}</p>
  
  <p>Now the documents in couchbase don't have the _class field  OR say if we are entering a different "key" and "value" for _class field as we don't want to rely on it, so this method fails. I sort of hacked a workaround for this using -</p>
  
  <p>`</p>
  
  <pre><code>@Override
  public Student getStudent(String name) {
      N1qlQuery query = N1qlQuery.simple(String.format("select *, META().id AS _ID, META().cas AS _CAS" +
              " from student where name = \'%s\';", name));
      return Optional.ofNullable(studentRepository.getCouchbaseOperations()
              .findByN1QL(query, StudentWrapper.class)
              .get(0))
              .map(StudentWrapper::getStudent)
              .orElseGet(() -&gt; {
                  throw new HttpClientErrorException(HttpStatus.NOT_FOUND);
              });
  }
  </code></pre>
  
  <p>`</p>
  
  <p>I was wondering if there is an alternate way of achieving this</p>