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

fetching list of documents #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

itoldya
Copy link

@itoldya itoldya commented Oct 29, 2014

Interface similar to mongolab - http://docs.mongolab.com/restapi/#list-documents

  • q=<query> - restrict results by the specified JSON query
  • c=true - return the result count for this query
  • s=<sort order> - specify the order in which to sort each specified field (1- ascending; -1 - descending)
  • sk=<num results to skip> - specify the number of results to skip in the result set; useful for paging
  • l=<limit> - specify the limit for the number of results

Examples

// find all active items
GET /doc/item/?q={"active":true}

// get the number of inactive items
GET /doc/tour/?q={"active":false}&c=true

// find the 10 most expensive items
GET /doc/tour/?l=10&s={"price": -1}

// find items from 10 to 20 sorted by title
GET /doc/tour/?l=10&sk=10&s={"name": 1}

Response example

{ 
  objects:  [ { 
       data: [Object],
       type: 'http://sharejs.org/types/simple',
       v: 1,
       docName: 'iphone5s',
       m: null 
  }, { 
       data: [Object],
       type: 'http://sharejs.org/types/simple',
       v: 1,
       docName: 'iphone6',
       m: null 
  }, { 
       data: [Object],
       type: 'http://sharejs.org/types/simple',
       v: 1,
       docName: 'iphone6plus',
       m: null 
  } ] ,
  meta: { 
       limit: 3, 
       offset: 1, 
       total_count: 4 
  },
}

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

Successfully merging this pull request may close these issues.

1 participant