Skip to content

If createdAt or updatedAt is already present, ignore adding it #31

@luckydev

Description

@luckydev

If a schema already has createdAt field, dont add it. Instead, add updatedAt field alone and maintain it. Vice versa for the updatedAt field.

Right now in version 0.3.0, this is the error I get when createdAt is already there and if I use mongoose-timestamp in that schema.

/Users/Anand/xyz/node_modules/mongoose-timestamp/index.js:34
      .get( function () {
       ^
TypeError: Object #<Object> has no method 'get'
    at timestampsPlugin (/Users/Anand/xyz/node_modules/mongoose-timestamp/index.js:34:8)
    at Schema.plugin (/Users/Anand/xyz/node_modules/mongoose/lib/schema.js:570:3)
    at Object.<anonymous> (/Users/Anand/xyz/models/session_token.js:12:20)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/Anand/xyz/models/agent.js:17:20)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions