Dynamic columns in the view mongodb

0

Hello,

I have a job where I need to create a view of a mongo db, but some columns of this view should be calculated at runtime, similar to mysql NOW (), for example: When I do a find in the view, I need a column comes with the current date.

I tried to create the view by setting a field with the value

{"meucampo": new Date()}

More mongo executes the date and records only the fixed result and when I go to the column meucampo it simply shows the date when I created the view rsrs

If you can help me please

Thank you

    
asked by anonymous 15.09.2017 / 21:39

1 answer

0

You can do this in the application, the closest mongodb has to that is $ currentDate .

Hope it helps. If you need anything else, paste a snippet of the application code.

    
15.09.2017 / 21:46