title: Why do I get array of nulls in my database?
body: <p>I have an array of ids which is <code>launchIds</code>. 
  I'm trying to push it on a model field <code>trips</code> with 
  <code>$addToSet: { trips: { $each: launchIds }</code>. This gives me an error: <code>Cast to [ObjectId] failed for value \"[\"1\",\"2\",\"3\"]\...</code></p>
  
  <p>if I try to map through <code>launchIds</code> and convert to <code>Mongoose.Shema.Types.ObjectId</code> I get in the database <code>trips: [null,null,null]</code></p>
  
  <p><code>lauchIds = ['1','2','3']</code></p>
  
  <pre><code>  async bookTrips({ launchIds }) {
      let userId = "5bf7f7b3817119363da48403";
  
      const mongoIds = launchIds.map(l =&gt; Mongoose.Schema.Types.ObjectId(l));
  
      return this.store.User.findByIdAndUpdate(
        { _id: userId },
        {
          $addToSet: { trips: { $each: mongoIds } }
        },
        { new: true }
      );
    }
  </code></pre>
  
  <p>Here's my model Schema:</p>
  
  <pre><code>  const UserSchema = new Mongoose.Schema(
      {
        email: {
          type: String,
          required: true
        },
        token: String,
        trips: [
          {
            type: Mongoose.Schema.Types.ObjectId,
            ref: "trip"
          }
        ]
      },
      { timestamps: true }
    );
  </code></pre>
  
  <p>I'm passing ids via grapql playground. Here's my <code>mutation</code>:</p>
  
  <pre><code>bookTrips: async (_, { launchIds }, { dataSources }) =&gt; {
    console.log(launchIds);
    // logs ['1','2','3']
    console.log(typeof launchIds);
    //Object 
  
    const results = await dataSources.userAPI.bookTrips({ launchIds });
    console.log(results);
  
    return { message: "hello" };
  }
  </code></pre>