Schema

noonjs uses the same schema format as Mongoose with some modifications. Every collection automatically includes an _id field of type ObjectId. It introduces a hash type for storing passwords securely and special default values like $.auth._id to reference the current user's _id and $.now for the current timestamp.

...
{
    "schema": {
        "title": {
            "type": "string"
        },
        "body": {
            "type": "string"
        },
        "publishedAt": {
            "type": "number",
            "default": "$.now"
        },
        "user": {
            "type": "string",
            "default": "$.auth._id"
        }
    }
}
...
Edit this page on Github
© 2025 kav3.com. Crafted with and dedication.