title: Jest expect mongoose timestamps
body: <p>I'm unit testing an Express / Mongoose API using Jest.
  However, I'm facing issues concerning expect "_id" and timestamps fields ("createdAt" and "updatedAt" for instance).</p>
  
  <pre><code>  const validBody = {
      email: faker.internet.email(),
      lastName: faker.name.lastName(),
      firstName: faker.name.firstName(),
      password: faker.internet.password()
    }
  
   // creation of an user by API call
   // ...
  
    const user = await User.findById(response.body.data._id)
  
    // OK
    expect(user._id).toEqual(expect.anything())
    expect(user.createdAt).toEqual(expect.anything())
  
    // FAIL
    expect(user).toEqual({
      ...validBody,
      _id: expect.anything(),
      createdAt: expect.anything()
    )}
  </code></pre>
  
  <p>Both first expects match fine. However, the last one using the full object doesn't match, whatever I put in expect.any(...) (even anything()). For instance for createdAt, I've tried "Object, Date, mongoose.Schema.Types.Date, String" ...</p>
  
  <p>Do you have any idea ? I believe mongoose is casting _id and createdAt objects into a plain field during two first expects. But, using expect.anything() in the object should match ... anything ?</p>
  
  <p>Thanks !</p>