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

Incorrect example in db.cloneCollection() documentation

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • Affects Version/s: None
    • Component/s: manual
    • Labels:
      None
    • 0.2

      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 } )
      

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

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