Skip to content

Commit

Permalink
Update Readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
SRoddis authored Jul 11, 2017
1 parent bf1258c commit c100dfc
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
![](https://media.giphy.com/media/10tLOFXDFDjgQM/giphy.gif)


Mongo.Migration is designed for [MongoDB C# Driver]( https://github.com/mongodb/mongo-csharp-driver) to migrate your documents easily on-the-fly.
No downtime for schema-migrations anymore. Just write small and simple `Migrations`.
Mongo.Migration is designed for the [MongoDB C# Driver]( https://github.com/mongodb/mongo-csharp-driver) to migrate your documents easily and on-the-fly.
No more downtime for schema-migrations. Just write small and simple `migrations`.

`Please NOTE` that updates are not intercepted, because updates don’t use serialization. You have to handle them by yourself.
`Please NOTE` that updates are not handled, because updates don’t use serialization. You have to handle them yourself.

# Installation

Expand All @@ -21,7 +21,7 @@ PM> Install-Package Mongo.Migration

# How to use

1. Initialize `MongoMigration` past the `MongoClient`. ([Mongo2Go](https://github.com/Mongo2Go/Mongo2Go))
1. Initialize `MongoMigration` behind the `MongoClient`. ([Mongo2Go](https://github.com/Mongo2Go/Mongo2Go))
```csharp
// Init MongoDB
var runner = MongoDbRunner.Start(); // Mongo2Go
Expand All @@ -30,7 +30,7 @@ PM> Install-Package Mongo.Migration
// Init MongoMigration
MongoMigration.Initialize();
```
2. Implement `IDocument` or add `Document` to your Entities to provide a `DocumentVersion`. (Optional) add the `CurrentVersion` attribute to mark the current document version. So you have the possibility to migrate down on rollback.
2. Implement `IDocument` or add `Document` to your entities to provide the `DocumentVersion`. (Optional) Add the `CurrentVersion` attribute to mark the current version of the document. So you have the possibility to downgrade in case of a rollback.

```csharp
[CurrentVersion("0.1.1")]
Expand All @@ -45,7 +45,7 @@ PM> Install-Package Mongo.Migration
public DocumentVersion Version { get; set; }
}
```
3. Create a `Migration<TDocument>` and mark it with the `MigrationMarker` attribute. The versioning should be done in [Semantic Versioning]( http://semver.org/). But it is open to you, if you just use the patch version to count the migrations. If there is duplication for a specific type and exception is thrown on initialization.
3. Create a `Migration<TDocument>` and mark it with the `MigrationMarker` attribute. The versioning should be done in [Semantic Versioning]( http://semver.org/). But it is up to you, wether you just use the patch version to count the number of migrations. If there is a duplicate for a specific type an exception is thrown on initialization.
```csharp
[MigrationMarker]
public class M001_RenameDorsToDoors : Migration<Car>
Expand All @@ -70,13 +70,13 @@ PM> Install-Package Mongo.Migration
}
}
```
4. `(Optional)` If you want to place your migrations in an extra project make sure you referance it in the main project and name the project like `"*.MongoMigrations"`. Bei convention Mongo.Migration collects all .dlls with the suffix `".MongoMigrations"` in your bin folder.
4. `(Optional)` If you want to put your migrations into an extra project make sure you reference it in the main project and name the project something like `"*.MongoMigrations"`. By convention Mongo.Migration collects all .dlls with the suffix `".MongoMigrations"` in your bin folder.

Compile, run and enjoy!

## Demo

In the repository you can find [Mongo.Migration.Demo]( https://github.com/SRoddis/Mongo.Migration/tree/master/Mongo.Migration.Demo) which is a simple demo to show how to use Mongo.Migration.
Inside of the repository you can find a [Mongo.Migration.Demo]( https://github.com/SRoddis/Mongo.Migration/tree/master/Mongo.Migration.Demo) which is a simple demo to show how to use Mongo.Migration.
1. Compile and run the demo application.
2. Now you should see the following output in the console.
Expand Down Expand Up @@ -110,13 +110,13 @@ In the repository you can find [Mongo.Migration.Demo]( https://github.com/SRoddi

## Suggestions

Deploy the migrations in a separate artifact. Otherwise you lose the ability to migrate down on rollback.
Deploy the migrations in a separate artifact. Otherwise you lose the ability to downgrade in case of a rollback.

## Performance

The performance is measured on every push to the repository with a small performance-test. It measures the time MongoDB need to insert and read `n documents` (5000) without and with Mongo.Migration. The difference is asserted and should be not higher than a given tolerance (150ms).
The performance is measured on every push to the repository with a small performance-test. It measures the time MongoDB needs to insert and read `n documents` (5000) with and without Mongo.Migration. The difference is asserted and should be not higher than a given tolerance (150ms).

Example Output of the automated test:
Example output of the automated test:
```bash
MongoDB: 73ms, Mongo.Migration: 168ms, Diff: 95ms (Tolerance: 150ms), Documents: 5000, Migrations per Document: 2

Expand Down

0 comments on commit c100dfc

Please sign in to comment.