Three containers, nested: a document is one record, a collection holds documents, a database holds collections. A collection's full name — its namespace — is database.collection, such as bookshelf.books, and must stay under 255 bytes; a database name under 64 bytes.
Nothing is declared in advance: insert into bookshelf.books and both the database and the collection appear on first write. There is no CREATE TABLE and no column list.
{ "_id": 1, "title": "Dune", "author": "Frank Herbert", "pages": 412 }
{ "_id": 2, "title": "Refactoring", "authors": ["Fowler", "Beck"],
"editions": [{ "year": 1999 }, { "year": 2018 }], "outOfPrint": false }That freedom is not an invitation. Documents in one collection should describe the same kind of thing and be read by the same queries; a schema still exists, it just lives in your application and, optionally, in a server-side validator (Schema Design). Data read together should be stored together — which is why the second document embeds its editions rather than pointing at an editions collection. Every example below runs with the bson package the driver installs, before any server listens.