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 8806399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:06:59+00:00 2026-06-14T02:06:59+00:00

I have an existing collection that I need to convert into a Capped Collection

  • 0

I have an existing collection that I need to convert into a Capped Collection using the method listed:

> db.runCommand({"convertToCapped": "mycoll", size: 100000});

However, the max field is not accepted as a parameter

> db.mycol1.convertToCapped
function (bytes) {
    if (!bytes) {
        throw "have to specify # of bytes";
    }
    return this._dbCommand({convertToCapped: this._shortName, size: bytes});
}

Any idea how to set this?

  • 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-14T02:07:00+00:00Added an answer on June 14, 2026 at 2:07 am

    max is only an option in the createCollection method, not convertToCapped:

    db.createCollection("mycoll", {capped:true, size:100000, max:100});
    

    There’s a cloneCollectionAsCapped, but it doesn’t look like there’s a max doc option there either: http://docs.mongodb.org/manual/reference/command/cloneCollectionAsCapped/

    You may need to create a new capped collection with the max parameter and transfer data and indices from the existing collection. See http://learnmongo.com/posts/easily-move-documents-between-collections-or-databases/

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

Sidebar

Related Questions

I have existing java code and need to create Design Document based on that.
I have a collection of elements that I need to operate over, calling member
I have a need for a collection type that allows for a multiple values
I have an existing mongo database where all documents in a collection have a
In Guava, if I have a Collection<T> - is there any existing function in
I have existing code that uses CMNewProfileSearch to find then iterate over the color
I have existing code with their own makefiles which I want to load into
The whole story; I have some KeyValuePairs that I need to store in a
We have a growing collection of .NET Web applications that have been localized in
I have a current implementation of will_paginate that uses the paginate_by_sql method to build

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.