Update values in array in MongoDB

db.Course.find().forEach(
    function(course) 
    {
        course.Sessions.forEach(function(session)
            {
                session._id=ObjectId();
            });
        db.Course.save(course);
    });
Topics: MongoDB

Related Code Examples