1

I am creating an application which stores about 1M documents in a bucket. Once stored, I am not able to retrieve all of them. I have created a view and I have added it as a Production View. When I run my application I am always able to retrieve only 1578 documents. The size of the ViewRow is also the same. I don't want to use N1QL.

Here is the function which is used to retrieve all the documents.

public Iterable findAllUsers() {

    ViewQuery query = ViewQuery.from("dev_LCDD", "findAllUsers");
    ViewResult result = theBucket.query(query);
    return result;

}

The function given below prints the size of the result which was returned by the findAllUsers() function and I am not able to get all the documents.

    public List findUserInformation() {
        Iterable result = theDao.findAllUsers();
        Gson gson = new GsonBuilder().create();
        ArrayList customers = new ArrayList();

        for (ViewRow row : result) {
            Customer cust = gson.fromJson(row.document().content().toString(), Customer.class);
            if(!docId.isEmpty())
            customers.add(cust);
        }
        System.out.println("List size: "+ customers.size());
        return customers;
    }

Can someone please help me with retrieving all the documents?

Edit: I am also unsure if my Java API still accesses only the Development View. This is because only if there exists a copy of the Production View in Development view, my application runs without any warning. I now removed the copy from Development View and the my view exists only in the Production View. I am getting the following warning, "com.couchbase.client.core.endpoint.ResponseStatusConverter fromHttp WARNING: Unknown ResponseStatus with Protocol HTTP: 500".

1 Answers1

2

The 'dev_' prefix is used for development design documents. If you want to use the published view, you need to remove it. So your code should be

public Iterable findAllUsers() {

    ViewQuery query = ViewQuery.from("LCDD", "findAllUsers");
    ViewResult result = theBucket.query(query);
    return result;

}
Laurent Doguin
  • 483
  • 2
  • 4