What is the best way to validate data in mongo?

后端 未结 5 1473
后悔当初
后悔当初 2020-12-06 11:39

What\'s the best way to validate data being inserted or updated into MongoDB? Is it to write some sort of server executed Javascript code that does the validation?

5条回答
  •  醉酒成梦
    2020-12-06 12:01

    Starting in 2.4, MongoDB enables basic BSON object validation for mongod and mongorestore when writing to MongoDB data files. This prevents any client from inserting invalid or malformed BSON into a MongoDB database. source: http://docs.mongodb.org/manual/release-notes/2.4/

提交回复
热议问题