What’s the meaning of ‘trim’ when use in mongoose?

It’s basically there to ensure the strings you save through the schema are properly trimmed. If you add { type: String, trim: true } to a field in your schema, then trying to save strings like " hello", or "hello ", or " hello ", would end up being saved as "hello" in Mongo – i.e. white spaces will be removed from both sides of the string.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)