[SERVER-9485] Copying documents across collections with modification to _id doesn't work Created: 26/Apr/13  Updated: 10/Dec/14  Resolved: 26/Apr/13

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.4.2
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Shaddy Zeineddine Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu Server 11.04


Attachments: File search-doc-migration-not-working.js     File search-doc-migration-working.js    
Issue Links:
Duplicate
duplicates SERVER-9385 Shell ignores modified object's "_id"... Closed
Operating System: Linux
Steps To Reproduce:

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

Participants:

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



 Comments   
Comment by Eliot Horowitz (Inactive) [ 26/Apr/13 ]

This is a duplicate of SERVER-9385 and is fixed in 2.4.3.

Generated at Thu Feb 08 03:20:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.