These are chat archives for Automattic/mongoose

11th
Mar 2016
James Lee
@uptownhr
Mar 11 2016 13:59
@ianmaddox maybe i didn't understand what "connect blocking" means. Can you explain?
Alex Shoronov
@underoot
Mar 11 2016 15:34
Hi all!
James Lee
@uptownhr
Mar 11 2016 15:34
hello
Alex Shoronov
@underoot
Mar 11 2016 15:36
@uptownhr Can You help me. It is normal behavior of mongoose that if I create schema with not required field with type, i.e. Boolean, I can set in this field null later?
James Lee
@uptownhr
Mar 11 2016 15:37
i believe so :)
Alex Shoronov
@underoot
Mar 11 2016 15:37
Why? What about type checking? :-)
James Lee
@uptownhr
Mar 11 2016 15:39
i don't think type of supposed to be checked against type
null is equivalent to not set
and you can definitely create models where it is not set
also, i don't believe it is type checking. Mongoose will attempt to cast to the type you specified
James Lee
@uptownhr
Mar 11 2016 15:45
so if schema, { test: String }
new model({test: 1})
test will become '1'
or {test: Boolean}
new model({test 'asdfasdfasdfasdf'})
test will be true
if {test: null}, then test will be null