title: How to find by and delete an item in a mongoose array
body: <p>So I have the following:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const Schema = mongoose.Schema;
  
  const PhotoSchema = new Schema({
    filename: { type: String, required: true },
    userId: { type: mongoose.Schema.Types.ObjectId, required: true },
    isPublic: { type: mongoose.Schema.Types.Boolean, default: false }
  }, { timestamps: true });
  
  const PhotoAlbumSchema = new Schema({
    name: { type: String, required: true },
    userId: { type: mongoose.Schema.Types.ObjectId, required: true },
    photos: { type: mongoose.Schema.Types.Array }
  }, { timestamps: true });</code></pre>
  </div>
  </div>
  </p>
  
  <p>My scenario is this: when I delete a Photo, I want to also delete it in the PhotoAlbum that contains it in photos.  What sort of query would I write to do this?</p>