

- #MONGODB COMPASS UNIQUE VALUES UPDATE#
- #MONGODB COMPASS UNIQUE VALUES CODE#
- #MONGODB COMPASS UNIQUE VALUES WINDOWS#
We showed the editor's auto-completion earlier, but it does more than complete $ operators. Cancel will revert the rules document to how it was when we started editing.
#MONGODB COMPASS UNIQUE VALUES UPDATE#
Notice the Update and Cancel buttons that appeared as soon as we started editing clicking Update will activate the new validation rules on the database. These rules aren't in place yet though, this is only a preview. There are no errors in our rules and the sample documents are back, complete with one document that passed and one that failed. If you are new to the JSON Schema Validation, We're looking at the AirBnB sample data, so let's add a rule that entries must have a cleaning_fee field.

Now we can enter a JSON Schema validation document. Support for $jsonSchema is new in Compass 1.18 and we do want to use it so we'll let autocomplete do its thing. The editor is smart enough to know that this early in the rules document, $jsonSchema is a likely candidate to be what we want. As the rules document is currently invalid, there's also nothing displayed in either of the sample document panels. If we go into the editor and start typing, we'll also see some more of the features of the new Validation view:Īs soon as we start typing, we are informed of errors in the rules and autocompletion kicks in offering up possible options.
#MONGODB COMPASS UNIQUE VALUES WINDOWS#
As we update the rule in the editor, the two document windows will also update to give rapid feedback on the effect the rules will have when applied. One will display a document from the collection that passes our validation rule, the other will display a document that fails. Below the editor is a new element, two windows for sample documents. The display is now centered on a JSON editor, with controls for how the validation rules are to be handled above it. We've already logged in and connected with Compass and we're viewing one of the sample datasets available on MongoDB Atlas. You can read about this older experience in " Adding Document Validation Rules Using MongoDB Compass 1.5".įor Compass 1.18, the addition of a context-sensitive, field-aware editor has allowed for the removal of the rules builder to produce a more interactive and responsive validation creation environment. A JSON editor was available to edit the generated rules. In earlier versions of Compass, a rules builder allowed MongoDB's own validation rules to be assembled in a controlled fashion.
#MONGODB COMPASS UNIQUE VALUES CODE#
MongoDB Compass is the official graphical client for MongoDB, offering the ability to deep dive into MongoDB databases and collections, create, edit, update, aggregate and delete data, perform index administration, view explain plans and turn your queries into code for applications.Ĭompass is available in a number of editions: a freely available community edition, a read-only edition and the full-featured version included with MongoDB Enterprise Advanced subscriptions.

This experience change also comes with support for JSON Schema validation. In the most recent update to MongoDB Compass, the user experience of creating validation rules has been dramatically refreshed.
