Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Added list function
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ihde committed Mar 25, 2010
1 parent 16dc735 commit dfb534c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions couchquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,15 @@ def get_revs(self, id_, fetch=False):
else:
yield rev["rev"]

def list(self):
"""List all documents ids in the database."""
response = self.http.get("_all_docs")
obj = dict( (str(k),v) for k,v in json.loads(response.body).iteritems() )
ids = []
for row in obj["rows"]:
ids.append(str(row["id"]))
return tuple(ids)

def exists(self):
response = self.http.get('')
if response.status == 404:
Expand Down

0 comments on commit dfb534c

Please sign in to comment.