Meteor-files: How to sort records by some kind of timestamp?

Created on 8 Jul 2017  路  4Comments  路  Source: veliovgroup/Meteor-Files

I'm looking for a way to sort records by created / modified time.
However I don't see any time related fields in the created mongoDB records.

(I'm using the latest version 1.8)
Any workaround? Thanks!

If it's a missing feature, I'm happy to submit a PR by adding a createdAt field.

question

Most helpful comment

Hi @dr-dimitru , that works like a champ. First time to learn you could sort by nested attributes. Great flexibility 馃憤

All 4 comments

Hello @rlhk ,

Pass timestamp into meta object, referred as settings.meta in the docs

And see this example

Let me know if it is helped.

Hi @dr-dimitru , that works like a champ. First time to learn you could sort by nested attributes. Great flexibility 馃憤

@rlhk glad it's solved for you.

Please, support this project by:

@rlhk

onInitiateUpload(file) {
    file.createdOn = new Date(); // semantic
    file.createdAt = new Date().getTime(); // value based
},

Above is the proper way to do it. Allowing the client to set the time means anyone in the debugger can create a fake time (spoof the time). Meta should be used for other information that is not security/time sensitive.

Was this page helpful?
0 / 5 - 0 ratings