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

  • Home
  • SEARCH
  • 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 6106737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:06:43+00:00 2026-05-23T14:06:43+00:00

I am building a cms where the site and pages are stored within mongo.

  • 0

I am building a cms where the site and pages are stored within mongo. I need to be able to create a new site using another site as a template.

For example:

   Site A - news page and home page 

Create a new site selecting site A as a template, this selects site A and then makes copies of each page site A owns and saves them under Site B

The result

   Site A - news page and home page 
   Site B - news page and home page 

Site B will be able to then use site A as a starting point to build there new site.

I am new to Mongo/mongoid so really would like some pointers about the best way to approach this.

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-05-23T14:06:43+00:00Added an answer on May 23, 2026 at 2:06 pm

    One way to organise the data is to use collections with the site ID as the namespace, giving you collections like:

    site_a.pages
    site_a.news
    site_a.users
    site_b.pages
    site_b.news
    site_b.users
    

    To create a new site from an existing one, you would copy the relevant collections (possibly excluding .users for example), changing the namespace. That is, copy site_a.pages to site_c.pages. In the shell:

    db.site_a.pages.find().forEach( function(x){db.site_c.pages.insert(x)} );
    

    Note that site_a is not a database name, but the namespace of a collection.

    There is a limit to the number of collections you can have in a database that might be a problem if you’re hosting the CMS in the cloud for many customers. You could get around this by having different databases for different customers. You should read the documentation on this for more details.

    Another way to do this is to put the site ID in each document and always filter for this in your queries. Then you would only have a few collections, for example:

    pages
    news
    users
    

    With the documents in those collections having a site_id field:

    {
        "site_id": "site_a",
        "page_title": "Homepage",
        ...
    }
    

    The copying would be similar to above (but with filters and updating the site_id field in the function). I think namespaces for collections is a neater approach however.

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

Sidebar

Related Questions

Hey frenz I am new to Umbraco cms. And I am building site using
I'm using IIS7 and ASP.NET. Basically building a simple CMS and need to handle
I'm trying to create a site using Orchard CMS. To get started, I downloaded
I'm currently building a little CMS for a smaller site. Now I want to
I'm looking for a simple CMS for a site I'm building for my girlfriend.
I'm building a CMS and I want to be able to insert stuff in
I am using wordpress as my cms and building a website. I use Graphene
I'm building a mini news CMS where the news added are sorted using a
I'm building a CMS using WebForms on .NET 4.0 and have the following route
I am building a CMS using Ruby on Rails to teach myself the framework.

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.