{"id":42589,"library":"daymon","title":"Daymon","description":"Daymon is an ORM for DynamoDB, currently at version 1.2.27. It provides a simple promise-based API for querying, scanning, saving, and updating items. Key features include automatic timestamp management, empty string conversion, and support for primary and secondary index queries. It is open-source but in early active development, so new versions are continuously published. Compared to other DynamoDB libraries like Dynamoose, Daymon is more lightweight with less abstraction, focusing on direct CRUD operations without schema definitions.","status":"active","version":"1.2.27","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install daymon","lang":"bash","label":"npm"},{"cmd":"yarn add daymon","lang":"bash","label":"yarn"},{"cmd":"pnpm add daymon","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Daymon is ESM-friendly but traditionally used with require. The default export is a factory function that takes options.","wrong":"const daymon = require('daymon');","symbol":"daymon","correct":"import daymon from 'daymon';"},{"note":"The require returns a function that must be called immediately with options. This is a common mistake where users try to call daymon as a constructor later.","wrong":"const daymon = require('daymon'); daymon(options);","symbol":"daymon (factory)","correct":"const daymon = require('daymon')(options);"},{"note":"After calling require('daymon')(options), you get a function that takes a table name and returns a model class. Users often try to call require directly with a table name.","wrong":"const Model = require('daymon')('users');","symbol":"Model (from factory)","correct":"const Model = daymon('users');"}],"quickstart":{"code":"const daymon = require('daymon')({\n  awsConfig: {\n    region: process.env.AWS_REGION ?? 'us-east-1',\n    accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? '',\n    secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? ''\n  },\n  convertEmptyStringToNull: true,\n  timeStamps: {\n    update: 'dateUpdated',\n    create: 'dateCreated'\n  }\n});\n\nconst User = daymon('users');\nconst user = new User({ name: 'John', email: 'john@example.com' });\nuser.save().then(item => {\n  console.log('Saved:', item);\n}).catch(err => {\n  console.error('Save failed:', err);\n});","lang":"javascript","description":"Demonstrates initializing Daymon with AWS config and timestamps, creating a model, saving an item, and handling the response."},"warnings":[{"fix":"Ensure query options contain a key matching the table's hash key or a defined secondary index.","message":"The options object for queries must include the table's primary hash key or a secondary index hash key; otherwise an error is thrown.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use the update() method explicitly if you want to update; or remove the hash key to force an insert.","message":"When saving an object that already has a primary hash key, an update is performed instead of an insert. This may overwrite existing attributes.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set convertEmptyStringToNull: true if you want empty strings to be stored as null, otherwise they will be skipped on updates.","message":"convertEmptyStringToNull: true converts empty strings to null. When false, empty string attributes are not updated at all.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pin to a specific version and test upgrades carefully.","message":"The library is in early development; breaking changes may occur without notice.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.2.27':11 'abstract':73 'activ':52 'api':19 'automat':30 'base':18 'compar':60 'continu':58 'convers':35 'crud':77 'current':8 'daymon':1,2,67 'definit':81 'develop':53 'direct':76 'dynamodb':7,63 'dynamoos':66 'earli':51 'empti':33 'featur':28 'focus':74 'includ':29 'index':42 'item':26 'javascript':82 'key':27 'less':72 'librari':64 'lightweight':70 'like':65 'manag':32 'new':55 'open':47 'open-sourc':46 'oper':78 'orm':5 'primari':39 'promis':17 'promise-bas':16 'provid':13 'publish':59 'queri':21,43 'save':23 'scan':22 'schema':80 'secondari':41 'simpl':15 'sourc':48 'string':34 'support':37 'timestamp':31 'updat':25 'version':10,56 'without':79","created_at":"2026-06-05T16:55:42.408457+00:00","updated_at":"2026-06-05T16:55:42.408457+00:00","problems":[{"fix":"Use require('daymon')(options) instead of just require('daymon').","cause":"Calling require('daymon') without calling it as a factory (missing the invocation with options).","error":"TypeError: daymon is not a function"},{"fix":"Include the hash key (e.g., { id: 'value' }) in the query options.","cause":"The query options object does not contain the primary hash key or a secondary index hash key.","error":"Error: Missing required parameter: hashKey"},{"fix":"Ensure the object passed to update() has the correct hash key matching the table schema.","cause":"Trying to update an item with a hash key that doesn't exist or using the wrong key structure.","error":"ValidationException: The provided key element does not match the schema"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"daymon","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}