Skip to content

Investigate pre save implications with index ref fields #86

@bojand

Description

@bojand

Schema

const schema = lounge.schema({
  name: String,
  email: { type: String, index: true, indexType: 'array', refKeyCase: 'lower' }
})

schema.pre('save', function (next) {
  if (this.email) {
    this.email = this.email.toLowerCase();
  }

  next();
});

const User = lounge.model('User', schema);

const user = new User({
  name: 'Bob',
  email: 'BOB@gmail.com'
});

user.save({ waitForIndex: true }, (err, saved) => {
  // ...
});

Investigate possible issues with this setup.
@scdowney @atrites Please add details.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions