mongodb

package
v1.4.6-prerelease06 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 0 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

What

This directory contains the mongodb schema for every database that cadence owns. The directory structure is as follows

./schema
   - cadence/               -- Contains schema for default data models
        - schema.json       -- Contains the latest & greatest snapshot of the schema for the keyspace
        - schema.go         -- Contains the collection schema in Golang structs -- because MongoDB collection is shemaless.  
        - versioned
             - v0.1/
             - v0.2/        -- One directory per schema version change
             - v1.0/
                - manifest.json    -- json file describing the change
                - changes.json     -- changes in this version, only [create collection/index/documents] commands are allowed

MongoDB JSON schema format

Below is an example of a schema JSON file containing two commands, for collection/index/documents creation.

[
  {
    "create": "collection_name"
  },
  {
    "createIndexes": "collection_name",
    "indexes": [
      {
        "key": {
          "fieldnamea": 1,
          "fieldnameb": -1
        },
        "name": "fieldnamea_fieldnameb"
      }
    ],
    "writeConcern": { "w": "majority" }
  },
  {
    "insert": "collection_name",
    "documents": [
      {
        "fieldnamea": 1,
        "fieldnameb": 0,
        "fieldnamec": "1234"
      },
      {
        "fieldnamea": 2,
        "fieldnameb": 1,
        "fieldnamec": "12344"
      },
      {
        "fieldnamea": 2,
        "fieldnameb": 2,
        "fieldnamec": "12345"
      }
    ],
    "ordered": false
  }
]

How

Q: How do I update existing schema ?

  • Add your changes to schema.json for snapshot
  • Create a new schema version directory under ./schema/<>/versioned/vx.x
    • Add a manifest.json
    • Add your changes in a json file

Documentation

Index

Constants

View Source
const Version = "0.1"

Version is the MongoDB database schema release version

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL