Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6761085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:08:39+00:00 2026-05-26T14:08:39+00:00

Using mongodb I’m trying to remove a property (_id) from a child collection (ListingFeatures)

  • 0

Using mongodb I’m trying to remove a property (_id) from a child collection (ListingFeatures) of its parent collection (Listing). To say it another way, I have a Listing object which has a list of ListingFeature objects in it. ListingFeature has an _id property which I’m trying to delete.

Here is the command I tried, which I thought would work:

db.Listing.update( { "ListingFeatures._id": { $exists:true } }, { $unset: { "ListingFeatures._id": 1 } }, false, true);

This ran for ~30 minutes before completing (Listing has 3 million records), it didn’t throw any errors or give any sort of message saying it was successful or unsuccessful, however the Listing.ListingFeatures._id property still exists.

What am I missing?

Here is a stripped down sample Listing document. Ultimately I want to remove _id, CreateDate, and UpdateDate from the ListingFeatures collections.

{
  "Address": "1080 DUNLAP ORPHANAGE RD",
  "City": "Unincorporated",
  "ListingFeatures": [
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Status: ACTIVE"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "County: Tipton"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Approximately 10 acre(s)"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "2 total full bath(s)"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "2 total half bath(s)"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "9 total rooms"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "2 stories"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Type:  General Residential"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Master Bedroom is Carpet, Full Bath, Level 1, Walk-In Closet"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Basement is Partial, Unfinished"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Pool features:  Above Ground"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "2 covered parking space(s)"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Yes car garage(s)"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Attached parking"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Cooling features:  220 Wiring, Dual System,Cooling"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Inclusions:  Cooktop, Dishwasher, Gas Cooking, Microwave, Refrigerator, Satellite Dish, Self Cleaning Oven"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Lot features:  Chain Fenced, Landscaped, Level, Some Trees, Wooded"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Lot size is between 10 and 20 acres"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Utilities present:  Public Water, Septic Tank"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Swimming pool(s)"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Basement"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Den"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Laundry room"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Hardwood floors"
    },
    {
      "_id": null,
      "CreateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "UpdateDate": "Sun, 03 Apr 2011 19:40:04 GMT -04:00",
      "Name": "Parking features:  Driveway/Pad, Garage Door Opener(s), Storage Room(s), Workshop(s)"
    }
  ],
  "ZipCode": "38011",
  "_id": {
    "$oid": "4d99055b1b9ba917bcef9443"
  }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:08:40+00:00Added an answer on May 26, 2026 at 2:08 pm

    Only one way with work for me.
    Work even with child inside child.

    var updated_comment = 0;
    db.Document.find().forEach(function(doc){
    
        function remove_errors(comments){
            comments.forEach(function(comment){
                delete comment.errors
                updated_comment = updated_comment + 1;
                remove_errors(comment.comments);
            });
        }
    
        remove_errors(doc.comments);
    
        db.Document.save(doc);
    });
    
    print("done updated_comment = " + updated_comment);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using MongoDB and need to remove duplicate records. I have a listing collection
I'm using MongoDB to hold a collection of documents. Each document has an _id
Using MongoDB I'm trying to copy a database from one server to another. My
I have very interested in using MongoDB it seems awesome. But I'm from a
Using mongodb in grails i am trying to get a hold of the database
Using mongodb with the NoRM driver I have this document: { _id : ObjectId(0758030341b870c019591900),
I'm using MongoDB with Mongoid and trying to put in place a rudimentary search
I am using MongoDB with C# driver. I managed to add/delete/update data from collections,
I am using mongodb now. I have a blogpost collection, and it has a
Currently we are using mongodb sharding in production server and having one collection called

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.