Can I use mongodb with Servicestack


Can I use mongodb with service statck ? If so appreciate some guidance.


We only have an Auth Provider for MongoDB, which you can add to your Modular Startup .NET Core projects with the mix dotnet tool these docs are specific to configuring MongoDB.

Most ServiceStack .NET Core projects are configured to use ModularStartup so can create a new project by installing our x dotnet tool:

$ dotnet tool install --global x 

Create your preferred project, e.g:

$ x new web ProjectName

Then mix in starter configuration to configure a Mongo Database, ServiceStack Auth and ServiceStack’s MongoDbAuthRepository:

$ x mix mongodb auth auth-mongodb

Or do both in a single command:

$ x new web+mongodb+auth+auth-mongodb ProjectName

You can also mix in a simple Auth Repository UI Feature in a #Script Pages project:

$ x new script+mongodb+auth+auth-mongodb+feature-authrepo ProjectName
1 Like