I'm trying to query a CouchDB database from Python and it works... but not entirely.
So, I created a partitioned DB with partition for movies, ratings, and tags and every partition _id is "partitionName : id".
Now I want to count the documents into ratings partition (100836 in the .csv file that I've downloaded)
After connection I do this:
mango1 = {"selector" : { "_id" : {"$regex" : "^ratings :"}}}
i = 0
for row in db.find(mango1):
i += 1
print ("Ratings are: ", i)
It prints always 25, but from GUI I know that are more than 25 docs. How can I fix this problem? I read that Mango isn't able to count like SQL.
You get always 25 because the default CoucheDB limit is 25 documents.
You need to increase either
Increase Limit of retrieved documents
To get for example 100 documents you could try this:
{"selector" : { "_id" : {"$regex" : "^ratings :"}}, "limit": 100}
Pagination A form of pagination could look like this:
{"selector" : { "_id" : {"$regex" : "^ratings :"}}, "limit": 50, "skip": 100}
This query will skip the first 100 documents and get you the following 50.