在mongoose中使用时,“修剪”的含义是什么?

链接是http://mongoosejs.com/docs/api.html#schema_string_SchemaString-trim

我是mongoosejs的初学者。 我只是不明白

我看到这个问题如何更新mongoose默认string模式属性修剪? 但不明白为什么修剪。 我今天创造了我的第一个模式,就像一个'你好世界'。

我看到这个https://stackoverflow.com/tags/trim/info …但是当我需要使用它,我想了解更多关于它。 我正在寻找一个解释dummie …

基本上这是为了确保通过模式保存的string被正确地修剪。 如果在模式中的字段中添加{ type: String, trim: true } ,然后尝试保存诸如" hello""hello "" hello "等string,最终将在Mongo中保存为"hello" – 即白色空间将被修剪。