Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-7923

Incorrect example in db.cloneCollection() documentation

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • manual
    • None
    • 0.2

    Description

      The example for db.cloneCollection() at the page https://docs.mongodb.com/manual/reference/method/db.cloneCollection/ stated:

      db.cloneCollection('mongodb.example.net:27017', 'users.profile',
                          { 'active' : true } )
      

      The users.profile collection name is incorrect, since currently the db.cloneCollection() function auto-appends the current database name (https://github.com/mongodb/mongo/blob/v3.4/src/mongo/shell/db.js#L382).

      The correct example should be (assuming we are in the users database):

      db.cloneCollection('mongodb.example.net:27017', 'profile',
                          { 'active' : true } )
      

      Attachments

        Activity

          People

            kevin.adistambha@mongodb.com Kevin Adistambha
            kevin.adistambha@mongodb.com Kevin Adistambha
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              6 years, 14 weeks, 6 days ago