Introduction to CouchDB with .NET part 18: Mango indexes and queries continued

Introduction

In the previous post we started discussing a new feature in CouchDB 2.0, namely Mango queries. Mango queries and Mango indexes are also based on views but these views are created for us, we don’t need to worry about them. Therefore Mango queries provide us with a tool to perform ad-hoc searches in CouchDB with a JSON-based query language. We spent most of the previous post on setting up a small database of ZIP codes that we use for our demos. The gateway to performing the queries is the POST /_find endpoint in the HTTP API. We attach the query to the HTTP request body. We looked at the various properties of the query where the selector is the most important. We also saw that the _id property is indexed by default and then carried out our first query based on the id.

In this post we’ll continue looking at Mango queries.

Read more of this post

Introduction to CouchDB with .NET part 17: starting with Mango queries

Introduction

In the previous post we discussed update design documents in CouchDB. Update functions make updating a document easier. They are not executed automatically when a document is updated. Instead, they must be called actively through a HTTP call. Update functions can make the update process easier since we don’t need to supply the revision ID. Also, they can have their own logic and add new rows to the document. An additional benefit is that we can send in the fields to be updated through the JSON body of the HTTP request. In other words we don’t need to provide all the properties of the document like in the case of a normal update we saw earlier.

In this post we’ll start looking into a brand new feature of CouchDB 2.0: Mango queries. A large part of the post is dedicated to setting up a ZIP code database that is slightly bigger than the demo databases we’ve been working with so far.

Read more of this post

Introduction to CouchDB with .NET part 16: update functions in design documents

Introduction

In the previous post we saw how show functions work in design documents. Show functions are applied on a single document and are able to transform that document into a different format. The formats can range from simple string manipulations to HTML reports. The show function has access to the HTTP request as well with its rich object which contains the request headers, the cookies, the query parameters and much more. Therefore the HTTP request can also be used to refine the logic within a show function.

In this post we’ll look at the last remaining design document function type called update functions.

Read more of this post

Introduction to CouchDB with .NET part 15: show functions in design documents

Introduction

In the previous post we took a look at lists in CouchDB design documents. Lists operate in conjunction with views. A list function has access to the output of a view and can transform it into a different data set. Lists do not change the underlying data at all, they are a type of extension to views. A list can output simple JSON or advanced HTML for fancy reports. We have access to the HTTP request object within the list function. The output of a list function can thus depend on stuff like query parameters, request headers, cookies etc.

In this post we’ll look at another function type in design documents called show functions.

Read more of this post

Introduction to CouchDB with .NET part 14: list functions in design documents

Introduction

In the previous post we looked at validation functions in CouchDB design documents. A validation function is used for data validation when inserting a new document or updating an existing one. It is called automatically upon an insert or update operation. We saw how to write a function that checks particular properties in the incoming document and throws an exception if it violates some business rules. We can also check whether the user executing the modification has a certain username or is in a user role, i.e. whether they are authorised to perform the action.

In this post we’ll look at lists in design documents.

Read more of this post

Introduction to CouchDB with .NET part 13: validation functions in design documents

Introduction

In the previous post we saw some additional examples of MapReduce functions in CouchDB view design documents. First we investigated the built-in _sum reducer which – as its name applies – can be used to sum up numerical values of the keys from the map phase. The reducer can sum up integers, arrays of integers and objects whose properties are integers. Then we looked at how grouping works and then continued with a brief discussion of custom reducers. We can write our own reducers in JavaScript but we need to make sure that we always return a single value. If we need multiple values from a reducer then can wrap them in a JSON object and return that. Also, the usage of the rereduce parameter is confusing at first and we might only need it in large data sets.

In this post we’ll take a look at another type of functions in design documents, namely validation functions.

Read more of this post

Introduction to CouchDB with .NET part 12: more MapReduce examples

Introduction

In the previous post we first saw how to insert and update design documents via the HTTP API. It is not very different from the equivalent operations on “normal” data documents. However, we need to consider the keywords in a design documents such as “views”, “map” and “reduce”. We also saw how to select compound keys and values in the map function of the view index. Compound keys are very helpful when executing more complex queries such as “select all users above the age 20 and an address in Washington”. We went through a number of examples about limiting the range of the result set using the startkey and endkey query parameters.

In this post we’ll continue where we left off previously and go through more MapReduce examples.

Read more of this post

ultimatemindsettoday

A great WordPress.com site

iReadable { }

.NET Tips & Tricks

Robin Sedlaczek's Blog

Developer on Microsoft Technologies

HarsH ReaLiTy

A Good Blog is Hard to Find

Softwarearchitektur in der Praxis

Wissenswertes zu Webentwicklung, Domain-Driven Design und Microservices

the software architecture

thoughts, ideas, diagrams,enterprise code, design pattern , solution designs

Technology Talks

on Microsoft technologies, Web, Android and others

Software Engineering

Web development

Disparate Opinions

Various tidbits

chsakell's Blog

Anything around ASP.NET MVC,WEB API, WCF, Entity Framework & AngularJS

Cyber Matters

Bite-size insight on Cyber Security for the not too technical.

Guru N Guns's

OneSolution To dOTnET.

Johnny Zraiby

Measuring programming progress by lines of code is like measuring aircraft building progress by weight.

%d bloggers like this: