abp-mongodblisted
Install: claude install-skill burakdmir/abp-skills
# ABP Framework — MongoDB
ABP Framework v10.4 MongoDB integration. MongoDbContext, collection mapping, repository, indexes, transactions.
## Trigger
- "ABP MongoDB"
- "ABP MongoDbContext"
- "ABP Mongo repository"
- "ABP Mongo collection"
- "ABP Mongo index"
- "ABP Mongo transaction"
## Installation
```bash
abp add-package Volo.Abp.MongoDB
```
```csharp
[DependsOn(typeof(AbpMongoDbModule))]
public class MyModule : AbpModule { }
```
## MongoDbContext
```csharp
public class MyDbContext : AbpMongoDbContext
{
public IMongoCollection<Question> Questions => Collection<Question>();
public IMongoCollection<Category> Categories => Collection<Category>();
protected override void CreateModel(IMongoModelBuilder modelBuilder)
{
base.CreateModel(modelBuilder);
modelBuilder.Entity<Question>(b => { b.CollectionName = "MyQuestions"; b.BsonMap.UnmapProperty(x => x.MyProperty); });
}
}
```
Or via attribute: `[MongoCollection("MyQuestions")]`
### Index
```csharp
modelBuilder.Entity<Question>(b =>
{
b.CreateCollectionOptions.Collation = new Collation(locale: "en_US", strength: CollationStrength.Secondary);
b.ConfigureIndexes(indexes => indexes.CreateOne(new CreateIndexModel<BsonDocument>(Builders<BsonDocument>.IndexKeys.Ascending("MyProperty"), new CreateIndexOptions { Unique = true })));
});
```
## DbContext Registration
```csharp
context.Services.AddMongoDbContext<MyDbContext>(options