Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8361545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:43:27+00:00 2026-06-09T11:43:27+00:00

According to DDD (Blue book, Evans) a Factory has the responsibility to create an

  • 0

According to DDD (Blue book, Evans) a Factory has the responsibility to create an Aggregate Root in a valid state. Does this mean it should be able to create the technical id (objectId in mongoDB world) as well as the domain id?

On the one hand, this seems like a technical detail and it would seem okay to let Mongo handle the creation of the ID.

On the other, enabling querying by id (by having getById in a DDD repository) exposes the technical id to the domain, which in turn would make it the responsibility of the Factory to create it.

Perhaps I can’t get my head on the different use-cases / overlap, etc. of Technical Id’s vs DomainId’s or perhaps I’m being overzealous, but I’d appreciate your opinion anyway.

In short:
In DDD: Should a factory be able to create the technical Id as well as the domain Id?

possible implementation: Hi/Lo ( How to set the hilo sequence starting value in MongoDB Norm?)

EDIT: although the hi/lo way exposes the Factory to the persistence layer, which is something only the Repository should know. hmmm

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:43:28+00:00Added an answer on June 9, 2026 at 11:43 am

    Factories don’t have to concern themselves with the ID because the validity of an aggregate is orthogonal to identity. Identity can be assigned in a few different ways, either as a incremental ID from a relational database in which case the repository has to manage it, or as a UUID/GUID in which case it can be assigned by the factory, or repository, or even the calling client which is convenient because then the client has the key by default.

    Whenever possible, I try to maintain a single identity for aggregates. I’m not sure if MongoDB requires an additional technical ID, but if it does and the domain ID can’t be used in its place, then MongoDB should manage it on its own and behind the scenes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've read DDD Evans, and I' experimenting with an aggregate root repository design using
According to JavaScript Patterns book (p. 79), this should work: var ob = {
According To reflector , ExpandoObject Does implemenet IDictionary<string, object> How ever I have this
According to this article I know, that DateTimePicker control does not reflect CurrentUICulture So,
According to this SO post: How to check the TEMPLATE_DEBUG flag in a django
According to PHP.net manual, pg_pconnect will create a persistent connection, or will return the
According to this post , IDEA uses Osmorc to run OSGi frameworks. It, in
According this article , generic JPA DAO(Data Access Object) is a pretty nice pattern.
According to this post in Recursive Descent vs. LALR , any LALR(k) can be
According to Steffen's post this is an efficient way to generate random BOOL s

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.