Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use Date rather than version number? #20

Open
sholtomaud opened this issue Mar 23, 2015 · 1 comment
Open

Is it possible to use Date rather than version number? #20

sholtomaud opened this issue Mar 23, 2015 · 1 comment

Comments

@sholtomaud
Copy link

Let's say you are interested to know the dates that different fields were updated in a document.

Am I able to use a Date field rather than "version"? Or does this feature already exist and I'm showing my nativity?

Currently data would look like this (I assume):

{
  _id: "4c6b9456f61f000000007ba6"
  latitude: [
    { version: 1, value: 141.1100011 },
    { version: 6, value: 141.1252105 }
  ]
}

Proposed Option would be stored like this

{
  _id: "4c6b9456f61f000000007ba6"
   latitude: [
    { date: 20150101, value: 141.1100011 },
    { date: 20150201, value: 141.1252105 }
  ]
}

@Ghalleb
Copy link

Ghalleb commented Dec 15, 2016

I had the same concern and ending up using
mongoose timestamps option property in my shema:
http://mongoosejs.com/docs/guide.html#timestamps
That did the trick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants