-
Notifications
You must be signed in to change notification settings - Fork 319
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
Model published
and/or updated
*(similar to created
)* field
#349
Comments
I used a Mongoose plugin called mongoose-timestamp before, which adds Aldo this is not backwards compatible, it might be good practice to use it for every model. Thinking about it, it may be backwards compatible for the |
Plugin looks nice, but we wouldn't want |
Sorry didn't (recall) seeing this ticket and probably didn't understand it at the time it was posted...anywhooo... Which other models did you want this added to? I already added it to |
Every single model can benifit from a
Eh? Are you talking about |
Please cite reference for this from mongoose package API docs. I'll try a query at some point in the near future to confirm. Thanks.
Depending on the citation and testing... this is doable... although if "createAt" isn't necessary we should avoid hard-coding it into the schema. |
Virtual functions aren't serialized into the db, nor are their calculated values, ergo you can't query over them. |
"Only non-virtual properties work as part of queries and for field selection." Thank you... elusive documentation and some contradicting elsewhere... also found Paraphrased quote for today:
|
I'm a little concerned with the issue on that repo at issue 26 ... would you validate that please? (no rush just when you have some time) I'd rather not add a dep (plugin) that might be considered abandonware... current last update is Feb 28, 2015... but he is active elsewhere. mongoose 3ish support is scheduled to be EOL'd in Sept 2015 and no backports of newer features are being made available at this time from what I've read. |
@Zren |
@Zren The difference between |
published
*(similar to created
) fieldpublished
*(similar to created
)* field
published
*(similar to created
)* fieldpublished
and/or updated
*(similar to created
)* field
Still might do |
Status of this has changed due to additional testing. Not that we need extra columns (which are already pushing it on portables) but the precision of I'll add a few |
* `_since` has a precision issue and possible extended time failure due to lack of bits * Fix a few timing issues * Best not to set default date in groups model as it can cover up errors and was doing it twice * Some identifier symmetry * All models should have base `created` with the exception of `removed` since once gone that's technically creation of nothingness. * Bump package version since older backups won't be valid after migration Applies to OpenUserJS#349
* `_since` has a precision issue and possible extended time failure due to lack of bits * Fix a few timing issues * Best not to set default date in groups model as it can cover up errors and was doing it twice * Some identifier symmetry * All models should have base `created` with the exception of `removed` since once gone that's technically creation of nothingness. * Bump package version since older backups won't be valid after migration Applies to #349 Auto-merge
Applies to OpenUserJS#349
* Change some UI centering. * If new columns for `created` and/or `updated` are wanted please open a new issue with relativity. * Since queries can be CPU intensive continue to limit some of these in the UI. * MongoDB 4.x has the ability to auto-create these per save/creation however finite control is usually needed rather than all the time/everywhere. Applies to OpenUserJS#485 and closes OpenUserJS#349
* Change some UI centering. * If new columns for `created` and/or `updated` are wanted please open a new issue with relativity. * Since queries can be CPU intensive continue to limit some of these in the UI. * MongoDB 4.x has the ability to auto-create these per save/creation however finite control is usually needed rather than all the time/everywhere. Applies to #485 and closes #349 Auto-merge
With MongoDB.
_id: { type: ObjectId }
(which is the default id type) is made up of a timestamp of when the object was created (plus a few other things to make it unique across servers when you distribute the db). We can use it right now to fetch the creation date of scripts and other models.It's currently possible to sort by creation date like so:
https://openuserjs.org/?orderBy=_id&orderDir=asc
To display it, we can use
_id.getTimestamp()
, but I think making a virtual (OWNER EDITED: static stored) propertyBaseSchema.created
would be best.The text was updated successfully, but these errors were encountered: