AnointedAutomation.Objects.Mongo 0.0.2

dotnet add package AnointedAutomation.Objects.Mongo --version 0.0.2
                    
NuGet\Install-Package AnointedAutomation.Objects.Mongo -Version 0.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AnointedAutomation.Objects.Mongo" Version="0.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AnointedAutomation.Objects.Mongo" Version="0.0.2" />
                    
Directory.Packages.props
<PackageReference Include="AnointedAutomation.Objects.Mongo" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AnointedAutomation.Objects.Mongo --version 0.0.2
                    
#r "nuget: AnointedAutomation.Objects.Mongo, 0.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AnointedAutomation.Objects.Mongo@0.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AnointedAutomation.Objects.Mongo&version=0.0.2
                    
Install as a Cake Addin
#tool nuget:?package=AnointedAutomation.Objects.Mongo&version=0.0.2
                    
Install as a Cake Tool

AnointedAutomation.Objects.Mongo

A .NET library providing MongoDB-specific data models with BSON serialization attributes, extending the base AnointedAutomation.Objects classes.

Overview

AnointedAutomation.Objects.Mongo provides MongoDB-specific versions of the core data models from AnointedAutomation.Objects. These classes add BSON attributes and MongoDB-specific serialization support while maintaining full compatibility with the base objects through inheritance.

Installation

Install via NuGet:

dotnet add package AnointedAutomation.Objects.Mongo

Features

  • MongoDB-Specific Models: Classes with [BsonId] and [BsonIgnoreExtraElements] attributes
  • BSON Serialization: Native MongoDB BSON serialization support
  • JObject Serialization: Custom serializer for Newtonsoft.Json JObjects to BSON
  • Inheritance Pattern: Extends base Objects classes, allowing seamless casting
  • Clean Separation: Keeps MongoDB dependencies separate from base models

Key Differences from AnointedAutomation.Objects

  • Adds [BsonId] attribute to ID properties
  • Adds [BsonIgnoreExtraElements] for flexible schema evolution
  • Includes JObjectSerializer for JObject to BSON conversion
  • Designed specifically for MongoDB persistence

Core Models

Account Namespace

  • MongoUser - MongoDB-specific user with [BsonId] on UserId
  • MongoProfile - MongoDB-specific profile with JObject serialization

Utilities

  • JObjectSerializer - Custom serializer for JObject to BSON conversion

Usage Example

using AnointedAutomation.Objects.Mongo.Account;
using MongoDB.Driver;

// Create a MongoDB-specific user
var mongoUser = new MongoUser
{
    UserId = Guid.NewGuid().ToString(),
    Email = "user@example.com",
    Username = "johndoe",
    createdDate = DateTime.UtcNow
};

// The MongoUser can be stored directly in MongoDB
// The UserId property is automatically used as the _id field
var collection = database.GetCollection<MongoUser>("users");
await collection.InsertOneAsync(mongoUser);

// Can also be used as base User type
User baseUser = mongoUser;

Dependencies

  • .NET 8.0
  • MongoDB.Bson (3.6.0)
  • Newtonsoft.Json (13.0.4)
  • AnointedAutomation.Objects (project reference)

License

Copyright © 2023 Anointed Automation, LLC. All rights reserved.

Author

Created by Alexander Fields

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.2 67 2/21/2026 0.0.2 is deprecated because it is no longer maintained.
0.0.1 74 2/20/2026