Mango search in Arrays

First, you need to create your index. I suggest that you create an index on the Calibration.Presettings.Date field. You can use the following JSON object to create it: { “index”: { “fields”: [ “_id”, “Calibration.Presettings.Date.[].Type” ] }, “type”: “json” } So the selector would be like this : { “selector”: { “Calibration.Presettings.Date”: { “$elemMatch”: { … Read more

CouchDB Document Update Handlers (in-place updates)

The example function in-place is not the same as “in-place” updates in other databases. CouchDB still uses an append-only architecture; document update handlers still create a new doc revision, etc. Still, update handlers are quite convenient and worth learning. Suppose you have a document with an accumulator. You want to accumulate an integer in a … Read more

SQL (MySQL) vs NoSQL (CouchDB) [closed]

Here’s a quote from a recent blog post from Dare Obasanjo. SQL databases are like automatic transmission and NoSQL databases are like manual transmission. Once you switch to NoSQL, you become responsible for a lot of work that the system takes care of automatically in a relational database system. Similar to what happens when you … Read more

Pagination in CouchDB?

The CouchDB Guide has a good discussion of pagination, including lots of sample code, here: http://guide.couchdb.org/draft/recipes.html#pagination Here’s their algorithm: Request rows_per_page + 1 rows from the view Display rows_per_page rows, store last row as next_startkey As page information, keep startkey and next_startkey Use the next_* values to create the next link, and use the others … Read more

Serialize and Deserialize Objective-C objects into JSON

Finally we can solve this problem easily using JSONModel. This is the best method so far. JSONModel is a library that generically serialize/deserialize your object based on Class. You can even use non-nsobject based for property like int, short and float. It can also cater nested-complex JSON. Considering this JSON example: { “accounting” : [{ … Read more