Skip to content

The search box in the website knows all the secrets—try it!

For any queries, join our Discord Channel to reach us faster.

JasperFx Logo

JasperFx provides formal support for Marten and other JasperFx libraries. Please check our Support Plans for more details.

How Documents are Stored

TODO -- feel like this is covered in the /document part and was copied there, so delete this page.

Marten will create a new database table and upsert function for each document type. By default, the table name is mt_doc_[alias] and the function is mt_upsert_[alias], where "alias" is the document type name in all lower case letters, or "parent type name + inner type name" for nested types.

In the not unlikely case that you need to disambiguate table storage for two or more documents with the same type name, you can override the type alias either programmatically with MartenRegistry:

cs
var store = DocumentStore.For(_ =>
{
    _.Connection(ConnectionSource.ConnectionString);

    _.Schema.For<User>().DocumentAlias("folks");
});

snippet source | anchor

or by decorating the actual document class with an attribute:

cs
[DocumentAlias("johndeere")]
public class Tractor
{
    public string id;
}

snippet source | anchor

Released under the MIT License.