Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query view with stale = ok does not work #719

Closed
nicolelovecoding opened this issue Jul 27, 2017 · 1 comment
Closed

Query view with stale = ok does not work #719

nicolelovecoding opened this issue Jul 27, 2017 · 1 comment

Comments

@nicolelovecoding
Copy link

nicolelovecoding commented Jul 27, 2017

Expected Behavior

it should return the data in the db I am querying

Current Behavior

It returns empty array

Steps to Reproduce (for bugs)

1, Set up a CouchDb running locally.
2, Try to query a view by:

var db = new PouchDB('http:https://admin:admin@localhost:5984/dbname');
db.query('design_name/view_name', {
      stale: 'ok',
      limit: limit,
      skip: skip,
      include_docs: true,
      reduce: false
    });

Context

I am writing a test for my project which needs to set up db locally and get data from it. The query sentence with stale = 'ok' actually works well with the remote cloudant database. But when I set up the CouchDb locally, it does not work.

Your Environment

  • Version used:v. 2.0.0
  • Browser Name and version:Chrome
  • Operating System and version (desktop or mobile): Mac
@wohali
Copy link
Member

wohali commented Jul 27, 2017

There is a difference between the Cloudant offering and your local CouchDB. Cloudant have a "view warming" service that automatically builds views for you in the background. CouchDB doesn't offer this functionality.

You have to build your view at least once, by querying it without the stale=ok option. Once you have done this once, subsequent queries can be made with stale=ok.

@wohali wohali closed this as completed Jul 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants