It seems like you can pass any string random string that doesn't match an IEEE 754 decimal to NumberDecimal and the shell will happily encode it as "NaN". Should it error if the value makes no sense?
MongoDB Enterprise repl0:PRIMARY> db.test.count() 0 MongoDB Enterprise repl0:PRIMARY> db.test.insert({d: NumberDecimal("this is total garbage")}) WriteResult({ "nInserted" : 1 }) MongoDB Enterprise repl0:PRIMARY> db.test.count() 1 MongoDB Enterprise repl0:PRIMARY> db.test.findOne() { "_id" : ObjectId("570ed43b02e7d49d28d860aa"), "d" : NumberDecimal("NaN") }