Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate pre save implications with index ref fields #86

Open
bojand opened this issue Jan 26, 2018 · 0 comments
Open

Investigate pre save implications with index ref fields #86

bojand opened this issue Jan 26, 2018 · 0 comments
Assignees

Comments

@bojand
Copy link
Contributor

bojand commented Jan 26, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant