Skip to content Skip to sidebar Skip to footer

What Is Mongodbs Strict Mode And Is It A Good Idea To Use?

I'm working on a node.js app that uses MongoDB and I read this from the docs: db.collection Fetch a specific collection (containing the actual collection information). If the appl

Solution 1:

http://mongodb.github.io/node-mongodb-native/api-generated/db.html#collection

strict, (Boolean, default:false) returns an error if the collection does not exist

Right there in the documentation.

That is there so your application may not create new collections itself and can only reference what has been created before. Hence the need for the callback, in order to trap the error.

Solution 2:

It might be referring to Javascript's strict mode instead of a Mongo specific feature. strict mode enables some optional but backwards incompatible changes in the Javascript language that help catch some bugs:

What does "use strict" do in JavaScript, and what is the reasoning behind it?

Post a Comment for "What Is Mongodbs Strict Mode And Is It A Good Idea To Use?"