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

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

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.2
    • Component/s: Shell
    • None
    • Environment:
      Ubuntu Server 11.04
    • Linux
    • 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.

      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" : ""
      }

        1. search-doc-migration-not-working.js
          0.5 kB
          Shaddy Zeineddine
        2. search-doc-migration-working.js
          0.6 kB
          Shaddy Zeineddine

            Assignee:
            Unassigned Unassigned
            Reporter:
            shaddyz Shaddy Zeineddine
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: