mongodb aggregations by date range, fill blank dates with data from previous documents

I have a dataset of records as following: { “_id”: 1, “itemId”: “t1”, “startDate”: ISODate(“2019-10-14T21:00:00.000+0000”), “endDate”: ISODate(“2019-10-16T21:00:00.000+0000”), “status”: “TODO” }, { “_id”: 2, “itemId”: “t1”, “startDate”: ISODate(“2019-10-17T21:00:00.000+0000”), “endDate”: null, “status”: “DONE” } where each document contains the current status of an item. if a document has an endDate – it means the item’s state was…

Access a page only if a user has admin role (React, Express, NodeJS, MongoDB)

I want to allow to access a page, “Users” which show all the users registered on the website, only if the user is admin, This is the component of the page : <Route path=”/users” exact component={Users} /> I tried something like this, but it didn’t work : Router.js <AdminRoute path=”/users” exact component={Users} /> AdminRoute/index.js import…