Home > Software engineering >  How to use $isNull in this query to return empty Users array
How to use $isNull in this query to return empty Users array

Time:12-27

Given a basic Mongoose user schema that uses timestamps (hence createdAt & updatedAt are available by default), I am trying to build a query that includes pagination server-side using aggregation.

So far, I have achieved the following that works pretty decently when there's data in the database and any filter matches any of the items in the collection.

{
    "users": [
        {
            "_id": "61c331f4bd87407c01b81324",
            "bio": "           
  • Related