Introduction to MongoDb with .NET part 17: various query related functions

Introduction

In the previous post we started looking into the querying techniques exposed by the MongoDb .NET driver. We looked at two ways of building queries: filter definition builders and LINQ-style queries. Filter definition builders are more powerful in my experience, meaning that they offer more complex querying techniques than the LINQ-style version. We applied the filters to the Find extension method that can be attached to a Mongo collection represented by the IMongoCollection of T interface. There are other find-related methods in the driver, called FindSync and its awaitable counterpart FindAsync but I think the Find extension method is more flexible.

In this post we’ll look at various query-related functions that can be attached to our searches. They correspond to a number of functions we looked at earlier while working in the Mongo shell: counting, limiting, skipping and sorting.

Read more of this post

Introduction to MongoDb with .NET part 16: querying in the .NET driver

Introduction

In the previous post we continued our exploration of data serialisation in the MongoDb .NET driver. We looked at various attributes such as BsonIgnore, BsonRepresentation or BsonIgnoreIfNull. Data serialisation is not too complex as long as the documents in MongoDb adhere to some schema, like in our demo restaurants and zipcodes collection. As soon as we have to deserialise an unordered set of documents then we’ll probably need to implement our own serialisation and things get more complicated. This is an additional reason to follow a schema even if MongoDb documents are schemaless.

In this post we’ll look at querying techniques in the .NET driver. We’ll build upon the demo .NET code we started building previously.

Read more of this post

Introduction to MongoDb with .NET part 15: object serialisation continued

Introduction

In the previous post we started looking into object serialisation in the MongoDb .NET driver. Serialisation attributes, like BsonElement help us declare the mapping between our C# objects and the corresponding documents. We can map JSON properties to C# properties, declare that a property is of a type that differs from its JSON counterpart and so on.

In this post we’ll look at some more examples of data serialisation in the MongoDb .NET driver. A good documentation is located on the MongoDb page dedicated to this topic. It goes through more advanced cases like supertypes and subtypes, custom serialisation and custom attributes.

Read more of this post

Introduction to MongoDb with .NET part 14: object serialisation in the .NET driver

Introduction

In the previous post we started working with the .NET driver for MongoDb. We started building a simple context class that acts as a handle on our MongoDb databases and collections. It will be a gateway to the documents in the collections as well. We also tested how to connect to the MongoDb server in code.

In this post we’ll continue to explore the .NET driver. In particular we’ll see how we can represent MongoDb documents in C# code. We’ll continue working on the demo .NET project we started in the previous post.

Read more of this post

Introduction to MongoDb with .NET part 13: starting with the MongoDb .NET driver

Introduction

In the previous post we looked at how to delete documents from a collection in the MongoDb shell. We saw that it wasn’t an overly complex operation. We just have to call the remove method on a collection and supply a query document like the ones we provide to the find function.

In this post we’ll start looking into how to communicate with MongoDb from a .NET project through the MongoDb .NET driver.

Read more of this post

Introduction to MongoDb with .NET part 12: deletions

Introduction

In the previous post we looked at a range of various update operations in MongoDb. We discussed the usage of a number of operators such as $unset and a set of operators used for arrays like $push and $addToSet. Finally we looked at the role of an upsert operation which is a combination of update and insert: update a document if it exists otherwise insert a new one.

In this post we’ll complete the CRUD operations in MongoDb by looking at deletions.

Read more of this post

Introduction to MongoDb with .NET part 11: various other update operations

Introduction

In the previous post we started looking into how updates are performed in the MongoDb client. We saw the update function in action with a number of examples. The most basic usage of update is cumbersome in the client as it really only replaces the existing document(s) with a new one. Fortunately there are various $ operators that let us update a single property of a document. We also saw the role of the “multi” argument. If set to true then the update function will update every single document that matches the search criteria. Otherwise only the first matching document will be updated.

In this post we’ll look into various other operations related to updates.

Read more of this post

Introduction to MongoDb with .NET part 10: updates

Introduction

In the previous post we looked at a couple of functions that can be applied in conjunction with searching and filtering. The limit function will return the first x number of items from the result set. The skip function skips the number of items specified by an integer argument. Limiting and skipping together are often used to page through a large result set. Finally we looked at the sort function which helps us sort the result set by one or more keys in ascending or descending order.

In this post we’ll start looking into updates.

Read more of this post

Introduction to MongoDb with .NET part 9: limiting, sorting and skipping

Introduction

In the previous post we looked a couple of array-related search operations in MongoDb. We saw examples for searching in arrays and sub-documents. We also went through operators such as $all and $in that are frequently used with arrays. In addition we saw the role of the dot notation to perform searches deeper down in the JSON object structure.

In this post we’ll look at various other functions related to searches: limiting, sorting and skipping that correspond to the TOP, ORDER BY and OFFSET/FETCH operators in MS SQL.

Read more of this post

Introduction to Amazon Code Pipeline with Java part 4: comparison with TeamCity and Jenkins

Introduction

In the previous post we saw how to add a custom job runner of type Test to an existing pipeline. These runners cannot be added to a pipeline during the setup process, they can be applied when updating one instead. We went through an example with the Apica Loadtest job runner and saw how to specify the necessary inputs for the job that the runner executes.

In this post we’ll discuss some of the key differences between TeamCity/Jenkins and CodePipeline (CP). TeamCity (TC) and Jenkins are quite similar so I will treat them as a group for this discussion.

Read more of this post

Elliot Balynn's Blog

A directory of wonderful thoughts

Software Engineering

Web development

Disparate Opinions

Various tidbits

chsakell's Blog

WEB APPLICATION DEVELOPMENT TUTORIALS WITH OPEN-SOURCE PROJECTS

Once Upon a Camayoc

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