Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9485

Copying documents across collections with modification to _id doesn't work

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.4.2
    • Fix Version/s: None
    • Component/s: Shell
    • Labels:
      None
    • Environment:
      Ubuntu Server 11.04
    • Operating System:
      Linux
    • Steps To Reproduce:
      Hide

      Read a document from a collection, modify its _id value, insert it into a new collection.

      Show
      Read a document from a collection, modify its _id value, insert it into a new collection.

      Description

      When a document is retrieved from a query, the _id value modified, and then inserted into a new collection, the _id value is ignored and the document is assigned a new ObjectId.

      > document
      {
      "_action" : "",
      "_id" : 189993,
      "_process" : "",
      "_status" : "",
      "author" : "devadmin",
      "category" : "Uncategorized",
      "content" : "when a new post is added to the Hero Module on GameFront's Homepage, the post is hidden from the RECENT ARTICLES module. Please remove this logic so posts that are added to the hero module can also appear in RECENT ARTICLES.",
      "published" : "2012-12-24T09:17:40Z",
      "source" : "gamefront",
      "summary" : "",
      "tags" : "Reviews",
      "title" : "A new post that test when post is in hero module",
      "type" : "post",
      "updated" : "2012-12-24T09:38:01Z",
      "uri" : "http://www.gamefront.com/a-new-post-that-test-when-post-is-in-hero-module/",
      "thumbnail" : ""
      }
      > db.gamefront.insert(document);
      > db.gamefront.findOne();
      {
      "_id" : ObjectId("517ac61539039707d1f6a250"),
      "_action" : "",
      "_process" : "",
      "_status" : "",
      "author" : "devadmin",
      "category" : "Uncategorized",
      "content" : "when a new post is added to the Hero Module on GameFront's Homepage, the post is hidden from the RECENT ARTICLES module. Please remove this logic so posts that are added to the hero module can also appear in RECENT ARTICLES.",
      "published" : "2012-12-24T09:17:40Z",
      "source" : "gamefront",
      "summary" : "",
      "tags" : "Reviews",
      "title" : "A new post that test when post is in hero module",
      "type" : "post",
      "updated" : "2012-12-24T09:38:01Z",
      "uri" : "http://www.gamefront.com/a-new-post-that-test-when-post-is-in-hero-module/",
      "thumbnail" : ""
      }

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: