U
U
Urukhayy2018-07-06 10:32:26
MongoDB
Urukhayy, 2018-07-06 10:32:26

Are there ready-made "wrappers" on mongodb with such functionality .....?

In many projects (based on mongoDB) on the back-end side, you need to do similar operations.
Let's take for example getting records from a collection filtered by date range . That is, documents have a date field , you need to set the minimum and maximum dates in the input parameters, and extract all documents that fall into this range. In mongoDB, you can use $gt and $lt for this, but to use this, you have to write a lot of accompanying code, without which you cannot access the collection. If there are many such calls in one project, a routine appears. And there are many such projects.
It would be nice to have a "wrapper" library that would allow you to call this filter in one line, and inside it would contain all the accompanying mongoDB code. And there can be many such functions for convenient work with tables, querying records within a range is just an example. There may be more complex schemes, with filters for 3,4,5 or more dates, with the search for intersections and range exceptions. Will not all this be implemented in each project in a new way?
Are there already ready-made wrappers? In which, for example, there is a range search?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan, 2018-07-06
@LiguidCool

Yes, there are such wrappers. For example here or here .
And of course, the universal option here .

A
Anubis, 2018-07-06
@Anubis

Have you tried Mongoose?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question