Snippets Collections
[
    {
        "$match": {
            "authorization": {
                "$ne": null
            }
        }
    },
    {
        "$match": {
            "email": {
                "$not": {
                    "$regularExpression": {
                        "pattern": "deleted",
                        "options": ""
                    }
                }
            }
        }
    },
 
    {
        "$lookup": {
            "from": "participant",
            "localField": "email",
            "foreignField": "email",
            "as": "userParticipant"
        }
    },
    {
        "$match": {}
    },
    {
        "$lookup": {
            "from": "masterSlot",
            "localField": "userParticipant._id",
            "foreignField": "navigatorId",
            "as": "slots"
        }
    },
    {
        "$lookup": {
            "from": "userCoachMapping",
            "localField": "userParticipant._id",
            "foreignField": "coachID",
            "as": "userCoachMapping"
        }
    },
    {
        "$project": {
        
            "isCoachActive": {
                "$arrayElemAt": [
                    "$userParticipant.active",
                    0
                ]
            },
        
            "email": {
                "$arrayElemAt": [
                    "$userParticipant.email",
                    0
                ]
            },
            "firstName": {
                "$arrayElemAt": [
                    "$userParticipant.firstName",
                    0
                ]
            },
            "coachProfileDescription": {
                "$arrayElemAt": [
                    "$userParticipant.coachProfileDescription",
                    0
                ]
            },
    
            "middleName": {
                "$arrayElemAt": [
                    "$userParticipant.middleName",
                    0
                ]
            },
            "lastName": {
                "$arrayElemAt": [
                    "$userParticipant.lastName",
                    0
                ]
            },
            "partnerShortCode": {
                "$arrayElemAt": [
                    "$userParticipant.partnerShortCode",
                    0
                ]
            },
    
            "role": {
                "$arrayElemAt": [
                    "$userParticipant.role",
                    0
                ]
            },
            "templateName": "$authorization.name",
            "servicePartnerShortCode": "$servicePartnerShortCode",
            "userVisibility": "$userVisibility",
    
            "Total Users": {
                "$size": {
                    "$filter": {
                        "input": "$userCoachMapping",
                        "as": "coach",
                        "cond": { "$eq": ["$$coach.userStatus", "ACTIVE"] }
                    }
                }
            }
            _id:0
        }
    },
    {
        $match:{
            "Total Users": { "$gt": 0 }
        }
    }
]
//show images
docker images

//show volumes
docker volume ls


//run docker container from image with attachd volume
//mongodb_dm - volume name
//mongo - container name
docker run -d --name mongo -v mongodb_dm:/data/db -p 27017:27017 mongo:latest
[
    {
        "$match": {
            "startDate": {
                "$gte": {
                    "$date": "2018-03-12T03:26:21.997Z"
                },
                "$lte": {
                    "$date": "2024-03-10T04:50:35Z"
                }
            }
        }
    },
    {
        "$lookup": {
            "from": "participant",
            "localField": "userId",
            "foreignField": "_id",
            "as": "participantData"
        }
    },
    {
        "$unwind": "$participantData"
    },
    {
        "$match": {
            "participantData.email": {
                "$regularExpression": {
                    "pattern": "@jiva.user",
                    "options": ""
                }
            }
        }
    },
    {
        "$match": {
            "participantData.userStatus": {
                "$ne": "TEST"
            }
        }
    },
    {
        "$match": {
            "$and": [
                {
                    "participantData.email": {
                        "$not": {
                            "$regularExpression": {
                                "pattern": "deleted",
                                "options": ""
                            }
                        }
                    }
                },
                {
                    "participantData.email": {
                        "$not": {
                            "$regularExpression": {
                                "pattern": "@smit\\.fit$",
                                "options": ""
                            }
                        }
                    }
                }
            ]
        }
    },
    {
        "$lookup": {
            "from": "participantBaselineAndFollowupData",
            "localField": "userId",
            "foreignField": "participantId",
            "as": "baselineData"
        }
    },
    {
        "$unwind": "$baselineData"
    },
    {
        "$lookup": {
            "from": "blood_glucose",
            "localField": "userId",
            "foreignField": "participantId",
            "as": "glucoseData"
        }
    },
    {
        "$unwind": "$glucoseData\", \"preserveNullAndEmptyArrays\" : true}"
    },
    {
        "$project": {
            "subscriptionId": "$_id",
            "baselineId": "$baselineData._id",
            "userId": 1,
            "startDate": 1,
            "programStartDate": "$baselineData.programStartDate",
            "planCode1": "$subscriptionPlan.programCode",
            "journeyStatus": "$journeyTrackerObject.status",
            "planCode2": "$baselineData.programCode",
            "followUps": "$baselineData.followUps",
            "glucoseData": 1
        }
    },
    {
        "$match": {
            "$and": [
                {
                    "$expr": {
                        "$and": [
                            {
                                "$eq": [
                                    "$planCode1",
                                    "$planCode2"
                                ]
                            },
                            {
                                "$eq": [
                                    "$startDate",
                                    "$programStartDate"
                                ]
                            }
                        ]
                    }
                }
            ]
        }
    },
    {
        "$group": {
            "_id": {
                "userId": "$userId",
                "startDate": "$startDate",
                "planCode1": "$planCode1"
            },
            "userId": {
                "$last": "$userId"
            },
            "baselineId": {
                "$last": "$baselineId"
            },
            "startDate": {
                "$last": "$startDate"
            },
            "programStartDate": {
                "$last": "$programStartDate"
            },
            "subscriptionId": {
                "$last": "$subscriptionId"
            },
            "journeyStatus": {
                "$last": "$journeyStatus"
            },
            "followUps": {
                "$last": "$followUps"
            },
            "glucoseData": {
                "$push": "$glucoseData"
            }
        }
    },
    {
        "$project": {
            "userId": 1,
            "baselineId": 1,
            "startDate": 1,
            "programStartDate": 1,
            "subscriptionId": 1,
            "journeyStatus": 1,
            "followUps": 1,
            "field": {
                "$add": [
                    "$_id.startDate",
                    {
                        "$multiply": [
                            14,
                            24,
                            60,
                            60,
                            1000
                        ]
                    }
                ]
            },
            "glucoseData": {
                "$filter": {
                    "input": "$glucoseData",
                    "as": "glucose",
                    "cond": {
                        "$and": [
                            {
                                "$lt": [
                                    "$$glucose.date",
                                    {
                                        "$add": [
                                            "$_id.startDate",
                                            {
                                                "$multiply": [
                                                    14,
                                                    24,
                                                    60,
                                                    60,
                                                    1000
                                                ]
                                            }
                                        ]
                                    }
                                ]
                            },
                            {
                                "$gte": [
                                    "$$glucose.date",
                                    "$_id.startDate"
                                ]
                            }
                        ]
                    }
                }
            }
        }
    },
    {
        "$project": {
            "userId": 1,
            "baselineId": 1,
            "startDate": 1,
            "programStartDate": 1,
            "subscriptionId": 1,
            "journeyStatus": 1,
            "followUps": 1,
            "glucoseData": {
                "$map": {
                    "input": "$glucoseData",
                    "as": "obj",
                    "in": {
                        "participantId": "$$obj.participantId",
                        "reading": "$$obj.reading",
                        "date": "$$obj.date"
                    }
                }
            }
        }
    }
]
[
    {
        "$match": {
            "participantId": ObjectId("6481b5f27050063532a46021")
        }
    },
    {
        "$match": {
            "date": { "$gt": { "$add": [ISODate("2023-06-01T00:00:00.000Z"), { "$multiply": [14, 24, 60, 60, 1000] }] } }
        }
    }
]
db.participantDietMealPlanDetails.updateMany({
    "mealPlan.dishVariation": "Milkshake",
	"_id":ObjectId("60d4258c4adb9a4b6fe4d99b")
},
    {
    $set: {
        "mealPlan.$[elem].dishVariation": "Milkshake",
        "mealPlan.$[elem].dishVariationId":  "660ea659e1645e032a289770",
        "mealPlan.$[elem].sizes": [{
                "calories": {
                    "value": "184",
                    "unit": "kcal"
                },
                "cookedWeight": "200",
                "name": "Medium Glass",
                "fat": {
                    "value": "5.0",
                    "unit": "gms"
                },
                "calcium": {
                    "value": "0.0",
                    "unit": "mg"
                },
                "iron": {
                    "value": "0.0",
                    "unit": "mg"
                },
                "fibre": {
                    "value": "0.0",
                    "unit": "mg"
                },
                "sodium": {
                    "value": "0.0",
                    "unit": "mg"
                },
                "sugars": {
                    "value": "0.0",
                    "unit": "mg"
                },
                "protein": {
                    "value": "4.7",
                    "unit": "gms"
                },
                "carbs": {
                    "value": "30.4",
                    "unit": "gms"
                }
            }
        ]

    }
}, {
    arrayFilters: [{
            "elem.dishVariation": "Milkshake"
        }
    ]
})
[
    {
        "$match": {
            "$expr": {
                "$ne": ["$foodStatus", "APPROVED"]
            }
        }
    },
    {
        "$lookup": {
            "from": "mastermealplan",
            "localField": "dishVariation",
            "foreignField": "mealPlan.dishVariation",
            "as": "mealData"
        }
    },
    {
        "$match": {
            "$expr": {
                "$gt": [{ "$size": "$mealData" }, 0]
            }
        }
    },
    {
        "$project": {
            "mealData": "$mealData.planName",
            "dishVariation": 1
        }
    }
]
[
    {
        "$match": {
            "partnerShortCode": {
                "$in": []
            }
        }
    },
    {
        "$group": {
            "_id": "$partnerShortCode",
            "clinics": {
                "$push": {
                    "clinicName": "$name",
                    "clinicId": "$_id"
                }
            }
        }
    },
    {
        "$project": {
            _id:0,
            "partnerShortCode": "$_id",
            "clinics": 1
        }
    }
]
[
  {
    $match: {
  $and: [
    { "age": { $type: "string" } },
    { $expr: { $gt: [{ $strLenCP: "$age" }, 5] } }
  ]
}
  },
    {
      $project: {
        email:1
      
    }
    }
  
]
[
    {
        $group: {
            _id: "$participantId",
            documents: { $push: "$$ROOT" },
            count: { $sum: 1 }
        }
    },
    {
        $match: {
            count: { $gt: 1 }
        }
    },
    {
        $unwind: "$documents"
    },
    {
        $match: {
            "documents.programCode": { $ne: "" }
        }
    },
    {
        $group: {
            _id: {
                participantId: "$_id",
                programCode: "$documents.programCode",
                programStartDate: "$documents.programStartDate"
            },
            baselineId: { $first: "$_id" },
            documentIds: { $push: "$documents._id" }, 
            documents: { $push: "$documents" },
            count: { $sum: 1 }
        }
    },
    {
        $match: {
            count: { $gt: 1 }
        }
    },
    {
        $project: {
            _id: 1,
            participantId: "$_id.participantId",
            programCode: "$_id.programCode",
            programStartDate: "$_id.programStartDate",
            baselineId: 1,
            documentIds: 1 
        }
    },
    {
        $lookup: {
            "from": "participant",
            "localField": "participantId",
            "foreignField": "_id",
            "as": "temp"
        }
    },
    {
        $match: {
            "temp.userStatus": { $ne: "TEST" },
            $and: [
                { "temp.email": { $nin: [/deleted/] } },
                { "temp": { $ne: null } }
            ]
        }
    },
    {
        $unwind:"$documentIds"
    }
    {
        $project: {
            _id:0
            "participantId": { $arrayElemAt: ["$temp._id", 0] },
            "email": { $arrayElemAt: ["$temp.email", 0] },
            "documentIds": 1 
        }
    }
]
[
    {
        $group: {
            _id: "$participantId",
            documents: { $push: "$$ROOT" },
            count: { $sum: 1 }
        }
    },
    {
        $match: {
            count: { $gt: 1 }
        }
    },
    {
        $unwind: "$documents"
    },
    {
        $match: {
            "documents.programCode": { $ne: "" }
        }
    },
    {
        $group: {
            _id: {
                participantId: "$_id",
                programCode: "$documents.programCode",
                programStartDate: "$documents.programStartDate"
            },
            documents: { $push: "$documents" },
            count: { $sum: 1 }
        }
    },
    {
        $match: {
            count: { $gt: 1 }
        }
    },
    {
        $project: {
            _id: 0,
            participantId: "$_id.participantId",
            programCode: "$_id.programCode",
            programStartDate: "$_id.programStartDate"
        }
    },
    {
        $lookup: {
            "from": "participant",
            "localField": "participantId",
            "foreignField": "_id",
            "as": "temp"
        }
    },
    {
        $match: {
            "temp.userStatus": { $ne: "TEST" }
        }
    },
    {
        $project: {
            "id":{ $arrayElemAt: ["$temp._id", 0] }
            "email": { $arrayElemAt: ["$temp.email", 0] }
        }
    }
]
[
    {
      "$lookup": {
        "from": "Assessment",
        "localField": "assessmentId",
        "foreignField": "_id",
        "as": "assessment"
      }
    },
    {
      "$unwind": {
        "path": "$assessment",
        "preserveNullAndEmptyArrays": true
      }
    },
    {
      "$match": {
        "$and": [
          {
            "assessmentId": {
              "$oid": "622072b1aaeb4e5955319304"
            },
            "endCode": {
              "$ne": ""
            }
          }
        ]
      }
    },
   {
  "$project": {
    "_id": 1,
    "name": {
      "$cond": {
        "if": { "$ifNull": ["$assessmentType", false] },
        "then": "$assessmentType",
        "else": "IDRS"
      }
    },
    "assessmentId": "$_id",
    "ok": "$assessment.type",
    "createdAt": 1
  }
}
,
   {
      "$sort": {
        "createdAt": -1
      }
    }

  ]
const query = {}; // Your query conditions go here

const [resultData, totalCount] = await Promise.all([
  User.find(query)
    .skip((page - 1) * limit)
    .limit(limit),

  User.countDocuments(query),
]);

console.log(resultData);
console.log(totalCount);
/* 
`mongoose.connect` is used to establish a connection to a MongoDB database, while `mongoose.connection` provides access to the active connection and allows you to interact with the database through events and operations.
*/
// see all the methods (https://mongoosejs.com/docs/api/connection.html)

const database = mongoose.connection;
// dbname
database.useDb("users");
// collection name
const collection = database.collection("users");
db.cities.aggregate([
  { "$project": { "id_city": { "$toString": "$_id" } } }, //combiente a string los ObjectIds
  { "$lookup": {
    "localField": "id_city",
    "from": "itineraries",
    "foreignField": "cityID",
 as: "matching_docs"
    }
  },
  {
    $match: {
      matching_docs: { $ne: [] } // Filtrar documentos que tienen coincidencias
    }
  }
])
db.cities.findOne({_id:ObjectId("64a47c1447972c5696cb0765")})
  
   db.cities.updateMany(
  {_id:ObjectId("64a47c1447972c5696cb0765")}, // Filtro vacío para actualizar todos los documentos
  {
    $pull: {
      "itineraries": "64efc056590b86b1be2cdd1e"
    }
  }
)
   db.cities.updateMany(
  {_id:ObjectId("64a47c1447972c5696cb0765")}, // Filtro vacío para actualizar todos los documentos
  {
    $push: {
      "itineraries": "64efc056590b86b1be2cdd1e"
    }
  }
)
   db.getCollection("cities").updateMany({_id:ObjectId("64a47c1447972c5696cb0765")},
{$push:{"itineraries":"64efc056590b86b1be2cdd1e"}})
use('myworlddb')

//{} empty fetches all documents
db.person.deleteMany({name:"hemanth"})
use('myworlddb')
 
//{} empty fetches all documents
db.person.deleteOne({name:"hemanth"})
use('myworlddb')

//{} empty fetches all documents
db.person.updateMany({age:{$lt:30}},{
  $set:{age: 1}
})
use('myworlddb')
 
//{} empty fetches all documents
db.person.updateOne({name:"hemanth"},{
  $set:{age: 28}
})
use('myworlddb')
 
//{} empty fetches all documents
db.person.find({name:"naveen"})
import graphql.kickstart.tools.GraphQLQueryResolver
import me.stegall.personalwebsiteapi3.models.Project
import me.stegall.personalwebsiteapi3.repositories.ProjectRepository
import org.springframework.data.mongodb.core.MongoOperations
import org.springframework.stereotype.Component

@Component
class ProjectQueryResolver(
  val projectRepository: ProjectRepository,
  private val mongoOperations: MongoOperations
) : GraphQLQueryResolver {
  fun projects(): List<Project> {
    return projectRepository.findAll()
  }
}
import me.stegall.personalwebsiteapi3.models.Project
import org.springframework.data.mongodb.repository.MongoRepository
import org.springframework.stereotype.Repository

@Repository
interface ProjectRepository : MongoRepository<Project, String>
use personal-website;

db.projects.insertMany([
  {
    "description": "This was my first major programming project that I ever saw through from start to finish. It's an emulator I wrote during the sophomore year of my undergrad. This was done so I could have a better understanding of emulation and basic hardware principles. Looking back now, it really lacks some understanding of useful C++ features and proper formatting, as well as typical C++ programming style. Regardless, I found it to be a very informative project that I learned quite a lot from.",
    "title": "SDL-CHIP8",
    "url": "https://gitlab.stegall.me/swstegall/SDL-CHIP8"
  },
  {
    "description": "Notflix was an application that I made for a class in my Master's to demonstrate my ability to create an application to consume an API using ASP.NET MVC. What it does is utilize a movie database API to give random movie suggestions over different genres. I thought my result at the end looked quite nice, given some of the constraints I dealt with in the original assignment.",
    "title": "Notflix",
    "url": "https://gitlab.stegall.me/swstegall/Notflix"
  },
  {
    "description": "This was an application I made for EarthX Hack 2020. It was inspired by the toilet paper shortage caused by the coronavirus pandemic of 2020. The idea for this app is to list goods that you have, that you wish to trade for other goods. It would allow people to accept a trade offer and a meeting location to exchange items, and cut down on over-consumption in the face of scarcity.",
    "title": "Green Trade",
    "url": "https://gitlab.stegall.me/swstegall/green-trade"
  },
  {
    "description": "Orpheus was my first attempt writing a GUI application with conventional tooling for Windows. It is a relatively lightweight C# music player application that manages its library based on a JSON file. I think the application works decently for the short amount of time I had to learn .NET beforehand, but that the theming component of the application, as well as some more advanced functionality, could be further enhanced. Perhaps I'll tackle a similar type of project in the future once Microsoft finishes their rollout of .NET MAUI.",
    "title": "Orpheus",
    "url": "https://gitlab.stegall.me/swstegall/Orpheus"
  },
  {
    "description": "This was a project I did for TAMUhack 2021 at the beginning of the year. This was my first attempt at a mobile app, and it used React Native, React Native Elements, and JavaScript for the frontend, and Node/Express/Sequelize/TypeScript on the backend, with a database managed with Docker. This was an interesting app, because it made use of barcode scanning to manage some gamification elements.",
    "title": "GOTcha",
    "url": "https://gitlab.stegall.me/swstegall/GOTcha"
  },
  {
    "description": "This project is a chat application that I made to allow for privately-hosted servers. It uses Material UI/React/Redux/TypeScript on the frontend, and Node/Express/Sequelize/TypeScript on the backend with a PostgreSQL database managed with Docker.",
    "title": "Trueno",
    "url": "https://gitlab.stegall.me/swstegall/trueno"
  },
  {
    "description": "This was a hackathon project I did with some friends for Hack-O-Lantern 2021. It's a Course Management Website that supports class creation, registration, and (some) file submission. It was a lot of fun to work on and shows some promise!",
    "title": "Class++",
    "url": "https://gitlab.stegall.me/swstegall/class-plus-plus"
  }
]);
db.timetable.updateMany(
   {},
   { $rename: { 'Train No': 'trainNo', 'Train Name': 'trainName', 'SEQ':'seq', 'Station Code':'stationCode', 'Station Name': 'stationName', 'Arrival time':'arrivalTime', 'Departure Time':'departureTime', 'Distance':'distance', 'Source Station':'sourceStation','Source Station Name':'sourceStationName', 'Destination Station':'destinationStation','Destination Station Name':'destinationStationName'  } }
)
const VoteSchema = new Schema({
  value: Boolean,
  obj: String,
  kind: String,
  user: String,
  voted: String
});

const PostSchema = new Schema({
  title: String
});

var virtual = PostSchema.virtual('voted', {
  ref: 'Vote',
  localField: '_id',
  foreignField: 'obj',
  justOne: true,
});

virtual.getters.unshift(v => !!v);

const Vote = mongoose.model('Vote', VoteSchema);
const Post = mongoose.model('Post', PostSchema);

co(function * () {
    // create post
  const post = new Post({
    title: 'post-1'
  });

  // create vote
  const vote = new Vote({
    value: true,
    obj: post.id,
    kind: Post.modelName,
    user: 'uid:1'
  });

  // store models to db
  yield [
    post.save(),
    vote.save()
  ];

  // populate related votes
  const r = yield Post.findById(post._id)
    .populate({path: 'voted', match: {user: 'uid:1', kind: Post.modelName}});

  console.log('r', r.toObject({ virtuals: true }));
  console.log(r.voted);
});
userSchema.pre('find', function (next) {
  if (this.options._recursed) {
    return next();
  }
  this.populate({ path: "followers following", options: { _recursed: true } });
  next();
});
db.Order.aggregate([
    { '$match'    : { "company_id" : ObjectId("54c0...") } },
    { '$sort'     : { 'order_number' : -1 } },
    { '$facet'    : {
        metadata: [ { $count: "total" }, { $addFields: { page: NumberInt(3) } } ],
        data: [ { $skip: 20 }, { $limit: 10 } ] // add projection here wish you re-shape the docs
    } }
] )
  const filteredData = datas[0].PostOffice.map(({ Name, State }) => {
    return { Name, State };
  });
db.customers.find({}).forEach(function (ch){db.customers.updateMany({},{$set:{"contact":ch.contact.toString()}})});
// require mongoose
const mongoose = require('mongoose');
// require config file to access mongoURI 
const config = require('config');
// make our db the mongoURI
const db = config.get('mongoURI');

const connectDB = async () => {
    try {
       await mongoose.connect(db, {
            useNewUrlParser: true,
            useCreateIndex: true,
            useUnifiedTopology: true,
            useFindAndModify: false
        })
        console.log('mongo db connected')
    } catch (err) {
        console.error(err)
        //exit with failure
        process.exit(1)
    }
}

module.exports = connectDB;
const getSourcesData = asyncHandler(async (req, res) => {
  const { dealership } = req.user;
  const month = parseInt(req.params.month);
  const customerData = await Customer.aggregate()
    .match({ dealership })
    .facet({
      fbCount: [
        {
          $match: {
            sourceOfEnquiry: "Facebook",
            $expr: { $eq: [{ $month: "$createdAt" }, month] },
          },
        },
        { $count: "fbCount" },
      ],
      googleCount: [
        {
          $match: {
            sourceOfEnquiry: "Google",
            $expr: { $eq: [{ $month: "$createdAt" }, month] },
          },
        },

        { $count: "googleCount" },
      ],
      cardekhoCount: [
        {
          $match: {
            sourceOfEnquiry: "Cardekho",
            $expr: { $eq: [{ $month: "$createdAt" }, month] },
          },
        },
        { $count: "cardekhoCount" },
      ],
      carwaleCount: [
        {
          $match: {
            sourceOfEnquiry: "Carwale",
            $expr: { $eq: [{ $month: "$createdAt" }, month] },
          },
        },
        { $count: "carwaleCount" },
      ],
      instagramCount: [
        {
          $match: {
            sourceOfEnquiry: "Instagram",
            $expr: { $eq: [{ $month: "$createdAt" }, month] },
          },
        },
        { $count: "instagramCount" },
      ],
      newspaperAdsCount: [
        {
          $match: {
            sourceOfEnquiry: "Newspaper Ads",
            $expr: { $eq: [{ $month: "$createdAt" }, month] },
          },
        },
        { $count: "newspaperAdsCount" },
      ],
      websiteCount: [
        {
          $match: {
            sourceOfEnquiry: "Website",
            $expr: { $eq: [{ $month: "$createdAt" }, month] },
          },
        },
        { $count: "websiteCount" },
      ],
      hoardingsCount: [
        {
          $match: {
            sourceOfEnquiry: "Hoardings",
            $expr: { $eq: [{ $month: "$createdAt" }, month] },
          },
        },
        { $count: "hoardingsCount" },
      ],
      telephonicCount: [
        {
          $match: {
            sourceOfEnquiry: "Telephonic",
            $expr: { $eq: [{ $month: "$createdAt" }, month] },
          },
        },
        { $count: "telephonicCount" },
      ],
      referralCount: [
        {
          $match: {
            sourceOfEnquiry: "Referral",
            $expr: { $eq: [{ $month: "$createdAt" }, month] },
          },
        },
        { $count: "referralCount" },
      ],
      workshopCount: [
        {
          $match: {
            sourceOfEnquiry: "Workshop",
            $expr: { $eq: [{ $month: "$createdAt" }, month] },
          },
        },
        { $count: "workshopCount" },
      ],
      bushfireCount: [
        {
          $match: {
            sourceOfEnquiry: "Bushfire",
            $expr: { $eq: [{ $month: "$createdAt" }, month] },
          },
        },
        { $count: "bushfireCount" },
      ],
      managementCount: [
        {
          $match: {
            sourceOfEnquiry: "Management",
            $expr: { $eq: [{ $month: "$createdAt" }, month] },
          },
        },
        { $count: "managementCount" },
      ],
      walkInCount: [
        {
          $match: {
            sourceOfEnquiry: "Walk-in",
            $expr: { $eq: [{ $month: "$createdAt" }, month] },
          },
        },
        { $count: "walkInCount" },
      ],
    });
  

  return res.status(200).json({
    success: true,
    tableData: customerData,
  });
});
{
  sourceOfEnquiry:'Telephonic',
    createdAt: {
        $gte: ISODate("2021-06-01T00:00:00.000Z"),
        $lte: ISODate("2021-06-30T00:00:00.000Z")
    }
}
db.users.updateMany(
  { __t: "SE" },
  {
    $set: {
      targets: [
        {
          modelName: "rapid",
          targetCount: 15,
          bookingCount: 0,
          deliveredCount: 0,
        },
        {
          modelName: "superb",
          targetCount: 10,
          bookingCount: 0,
          deliveredCount: 0,
        },
        {
          modelName: "kushaq",
          targetCount: 5,
          bookingCount: 0,
          deliveredCount: 0,
        },
        {
          modelName: "octavia",
          targetCount: 0,
          bookingCount: 0,
          deliveredCount: 0,
        },
      ],
    },
  }
);
// create a schema
const eventSchema = new Schema({
  name: String,
  slug: {
    type: String,
    unique: true
  },
  description: String
});

// create the model
const eventModel = mongoose.model('Event', eventSchema);

// middleware -----
// make sure that the slug is created from the name
eventSchema.pre('save', function(next) {
  this.slug = slugify(this.name);
  next();
});

// function to slugify a name
function slugify(text) {
  return text.toString().toLowerCase()
    .replace(/\s+/g, '-')           // Replace spaces with -
    .replace(/[^\w\-]+/g, '')       // Remove all non-word chars
    .replace(/\-\-+/g, '-')         // Replace multiple - with single -
    .replace(/^-+/, '')             // Trim - from start of text
    .replace(/-+$/, '');            // Trim - from end of text
}
const dateFilter = asyncHandler(async (req, res) => {
  const month = 7;
  const day = 13;
  const feedbacks = await Feedback.find({
    $expr: {
      $or: [
        {
          $and: [
            { $eq: [{ $month: "$birthday" }, month] },
            { $eq: [{ $dayOfMonth: "$birthday" }, day] },
          ],
        },
        {
          $and: [
            { $eq: [{ $month: "$anniversary" }, month] },
            { $eq: [{ $dayOfMonth: "$anniversary" }, day] },
          ],
        },
      ],
    },
  });
  res.send(feedbacks);
});
const dateFilter = asyncHandler(async (req, res) => {
  const month = 6;
  const day = 10;
  const feedbacks = await Feedback.find({
    $expr: {
      $or: [
        {
          $eq: [{ $month: "$birthday" }, month],
          $eq: [{ $dayOfMonth: "$birthday" }, day],
        },
        {
          $eq: [{ $month: "$anniversary" }, month],
          $eq: [{ $dayOfMonth: "$anniversary" }, day],
        },
      ],
    },
  });
  console.log({ feedbacks });
});
const mongoose = require('mongoose');

const server = '127.0.0.1:27017'; // REPLACE WITH YOUR OWN SERVER
const database = 'test';          // REPLACE WITH YOUR OWN DB NAME

const connectDB = async () => {
    try {
        await mongoose.connect(`mongodb://${server}/${database}`, {
            useNewUrlParser: true,
            useUnifiedTopology: true,
            useFindAndModify: false,
            useCreateIndex: true
        });

        console.log('MongoDB connected!!');
    } catch (err) {
        console.log('Failed to connect to MongoDB', err);
    }
};

connectDB();
const bookingNumber = `${_.upperCase(modelName)}${_.random(1000000, 9999999)}
const updateStatus = asyncHandler(async (req, res) => {
  console.log("k");
  const { customer, stageFiveId, availableLoansId, status } = req.body;
  console.log(req.body);
  const customerData = await Customer.updateMany(
    {
      _id: customer,
    },
    // db.coll.update({}, {$set: {“a.$[i].c.$[j].d”: 2}}, {arrayFilters: [{“i.b”: 0}, {“j.d”: 0}]})
    {
      $set: { "stage5.$[i].availableLoans.$[j].status": status },
    },
    { arrayFilters: [{ "i._id": stageFiveId }, { "j._id": availableLoansId }] }
  );
  console.log(customerData);
  if (customerData)
    return res.status(200).json({
      success: true,
      message: "Status updated sucessfully!",
    });
  else
    return res.status(400).json({
      success: false,
      message: "Could not able to update Status!",
    });
});
db.customers.updateMany({}, {$unset:{"customerName":1}})
db.customers.updateMany({}, {$unset:{"customerName":1}})
db.customers.updateMany({},
  [{ $set : { n : {$arrayElemAt:[{ $split: ["$customerName", " "] },1]}} }],

);
db.customers.updateMany({},
  [{ $set : { m : {$arrayElemAt:[{ $split: ["$customerName", " "] },0]}} }],

);
   var Person = mongoose.model('Person', yourSchema);
   // find each person with a name contains 'Ghost'
   Person.findOne({ "name" : { $regex: /Ghost/, $options: 'i' } },
          function (err, person) {
                 if (err) return handleError(err);
                 console.log('%s %s is a %s.', person.name.first, person.name.last, person.occupation);

   });
star

Thu Apr 25 2024 04:12:30 GMT+0000 (Coordinated Universal Time) http://34.74.16.180:3000/question#eyJkYXRhc2V0X3F1ZXJ5Ijp7InR5cGUiOiJuYXRpdmUiLCJuYXRpdmUiOnsiY29sbGVjdGlvbiI6InVzZXJzIiwicXVlcnkiOiJbXHJcbiAgICB7XHJcbiAgICAgICAgXCIkbWF0Y2hcIjoge1xyXG4gICAgICAgICAgICBcImF1dGhvcml6YXRpb25cIjoge1xyXG4gICAgICAgICAgICAgICAgXCIkbmVcIjogbnVsbFxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgfSxcclxuICAgIHtcclxuICAgICAgICBcIiRtYXRjaFwiOiB7XHJcbiAgICAgICAgICAgIFwiZW1haWxcIjoge1xyXG4gICAgICAgICAgICAgICAgXCIkbm90XCI6IHtcclxuICAgICAgICAgICAgICAgICAgICBcIiRyZWd1bGFyRXhwcmVzc2lvblwiOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIFwicGF0dGVyblwiOiBcImRlbGV0ZWRcIixcclxuICAgICAgICAgICAgICAgICAgICAgICAgXCJvcHRpb25zXCI6IFwiXCJcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcbiAgICB9LFxyXG4gXHJcbiAgICB7XHJcbiAgICAgICAgXCIkbG9va3VwXCI6IHtcclxuICAgICAgICAgICAgXCJmcm9tXCI6IFwicGFydGljaXBhbnRcIixcclxuICAgICAgICAgICAgXCJsb2NhbEZpZWxkXCI6IFwiZW1haWxcIixcclxuICAgICAgICAgICAgXCJmb3JlaWduRmllbGRcIjogXCJlbWFpbFwiLFxyXG4gICAgICAgICAgICBcImFzXCI6IFwidXNlclBhcnRpY2lwYW50XCJcclxuICAgICAgICB9XHJcbiAgICB9LFxyXG4gICAge1xyXG4gICAgICAgIFwiJG1hdGNoXCI6IHt9XHJcbiAgICB9LFxyXG4gICAge1xyXG4gICAgICAgIFwiJGxvb2t1cFwiOiB7XHJcbiAgICAgICAgICAgIFwiZnJvbVwiOiBcIm1hc3RlclNsb3RcIixcclxuICAgICAgICAgICAgXCJsb2NhbEZpZWxkXCI6IFwidXNlclBhcnRpY2lwYW50Ll9pZFwiLFxyXG4gICAgICAgICAgICBcImZvcmVpZ25GaWVsZFwiOiBcIm5hdmlnYXRvcklkXCIsXHJcbiAgICAgICAgICAgIFwiYXNcIjogXCJzbG90c1wiXHJcbiAgICAgICAgfVxyXG4gICAgfSxcclxuICAgIHtcclxuICAgICAgICBcIiRsb29rdXBcIjoge1xyXG4gICAgICAgICAgICBcImZyb21cIjogXCJ1c2VyQ29hY2hNYXBwaW5nXCIsXHJcbiAgICAgICAgICAgIFwibG9jYWxGaWVsZFwiOiBcInVzZXJQYXJ0aWNpcGFudC5faWRcIixcclxuICAgICAgICAgICAgXCJmb3JlaWduRmllbGRcIjogXCJjb2FjaElEXCIsXHJcbiAgICAgICAgICAgIFwiYXNcIjogXCJ1c2VyQ29hY2hNYXBwaW5nXCJcclxuICAgICAgICB9XHJcbiAgICB9LFxyXG4gICAge1xyXG4gICAgICAgIFwiJHByb2plY3RcIjoge1xyXG4gICAgICAgIFxyXG4gICAgICAgICAgICBcImlzQ29hY2hBY3RpdmVcIjoge1xyXG4gICAgICAgICAgICAgICAgXCIkYXJyYXlFbGVtQXRcIjogW1xyXG4gICAgICAgICAgICAgICAgICAgIFwiJHVzZXJQYXJ0aWNpcGFudC5hY3RpdmVcIixcclxuICAgICAgICAgICAgICAgICAgICAwXHJcbiAgICAgICAgICAgICAgICBdXHJcbiAgICAgICAgICAgIH0sXHJcbiAgICAgICAgXHJcbiAgICAgICAgICAgIFwiZW1haWxcIjoge1xyXG4gICAgICAgICAgICAgICAgXCIkYXJyYXlFbGVtQXRcIjogW1xyXG4gICAgICAgICAgICAgICAgICAgIFwiJHVzZXJQYXJ0aWNpcGFudC5lbWFpbFwiLFxyXG4gICAgICAgICAgICAgICAgICAgIDBcclxuICAgICAgICAgICAgICAgIF1cclxuICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgXCJmaXJzdE5hbWVcIjoge1xyXG4gICAgICAgICAgICAgICAgXCIkYXJyYXlFbGVtQXRcIjogW1xyXG4gICAgICAgICAgICAgICAgICAgIFwiJHVzZXJQYXJ0aWNpcGFudC5maXJzdE5hbWVcIixcclxuICAgICAgICAgICAgICAgICAgICAwXHJcbiAgICAgICAgICAgICAgICBdXHJcbiAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgIFwiY29hY2hQcm9maWxlRGVzY3JpcHRpb25cIjoge1xyXG4gICAgICAgICAgICAgICAgXCIkYXJyYXlFbGVtQXRcIjogW1xyXG4gICAgICAgICAgICAgICAgICAgIFwiJHVzZXJQYXJ0aWNpcGFudC5jb2FjaFByb2ZpbGVEZXNjcmlwdGlvblwiLFxyXG4gICAgICAgICAgICAgICAgICAgIDBcclxuICAgICAgICAgICAgICAgIF1cclxuICAgICAgICAgICAgfSxcclxuICAgIFxyXG4gICAgICAgICAgICBcIm1pZGRsZU5hbWVcIjoge1xyXG4gICAgICAgICAgICAgICAgXCIkYXJyYXlFbGVtQXRcIjogW1xyXG4gICAgICAgICAgICAgICAgICAgIFwiJHVzZXJQYXJ0aWNpcGFudC5taWRkbGVOYW1lXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgMFxyXG4gICAgICAgICAgICAgICAgXVxyXG4gICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICBcImxhc3ROYW1lXCI6IHtcclxuICAgICAgICAgICAgICAgIFwiJGFycmF5RWxlbUF0XCI6IFtcclxuICAgICAgICAgICAgICAgICAgICBcIiR1c2VyUGFydGljaXBhbnQubGFzdE5hbWVcIixcclxuICAgICAgICAgICAgICAgICAgICAwXHJcbiAgICAgICAgICAgICAgICBdXHJcbiAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgIFwicGFydG5lclNob3J0Q29kZVwiOiB7XHJcbiAgICAgICAgICAgICAgICBcIiRhcnJheUVsZW1BdFwiOiBbXHJcbiAgICAgICAgICAgICAgICAgICAgXCIkdXNlclBhcnRpY2lwYW50LnBhcnRuZXJTaG9ydENvZGVcIixcclxuICAgICAgICAgICAgICAgICAgICAwXHJcbiAgICAgICAgICAgICAgICBdXHJcbiAgICAgICAgICAgIH0sXHJcbiAgICBcclxuICAgICAgICAgICAgXCJyb2xlXCI6IHtcclxuICAgICAgICAgICAgICAgIFwiJGFycmF5RWxlbUF0XCI6IFtcclxuICAgICAgICAgICAgICAgICAgICBcIiR1c2VyUGFydGljaXBhbnQucm9sZVwiLFxyXG4gICAgICAgICAgICAgICAgICAgIDBcclxuICAgICAgICAgICAgICAgIF1cclxuICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgXCJ0ZW1wbGF0ZU5hbWVcIjogXCIkYXV0aG9yaXphdGlvbi5uYW1lXCIsXHJcbiAgICAgICAgICAgIFwic2VydmljZVBhcnRuZXJTaG9ydENvZGVcIjogXCIkc2VydmljZVBhcnRuZXJTaG9ydENvZGVcIixcclxuICAgICAgICAgICAgXCJ1c2VyVmlzaWJpbGl0eVwiOiBcIiR1c2VyVmlzaWJpbGl0eVwiLFxyXG4gICAgXHJcbiAgICAgICAgICAgIFwiVG90YWwgVXNlcnNcIjoge1xyXG4gICAgICAgICAgICAgICAgXCIkc2l6ZVwiOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgXCIkZmlsdGVyXCI6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgXCJpbnB1dFwiOiBcIiR1c2VyQ29hY2hNYXBwaW5nXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiYXNcIjogXCJjb2FjaFwiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBcImNvbmRcIjogeyBcIiRlcVwiOiBbXCIkJGNvYWNoLnVzZXJTdGF0dXNcIiwgXCJBQ1RJVkVcIl0gfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBfaWQ6MFxyXG4gICAgICAgIH1cclxuICAgIH0sXHJcbiAgICB7XHJcbiAgICAgICAgJG1hdGNoOntcclxuICAgICAgICAgICAgXCJUb3RhbCBVc2Vyc1wiOiB7IFwiJGd0XCI6IDAgfVxyXG4gICAgICAgIH1cclxuICAgIH1cclxuXSIsInRlbXBsYXRlLXRhZ3MiOnt9fSwiZGF0YWJhc2UiOjJ9LCJkaXNwbGF5IjoidGFibGUiLCJ2aXN1YWxpemF0aW9uX3NldHRpbmdzIjp7fX0=

#aggregation #mongodb #map #filter #size
star

Thu Apr 18 2024 19:38:43 GMT+0000 (Coordinated Universal Time)

#docker #mongodb
star

Fri Apr 12 2024 03:17:10 GMT+0000 (Coordinated Universal Time)

#aggregation #mongodb #date #map #filter
star

Fri Apr 12 2024 03:15:55 GMT+0000 (Coordinated Universal Time) eyJkYXRhc2V0X3F1ZXJ5Ijp7InR5cGUiOiJuYXRpdmUiLCJuYXRpdmUiOnsiY29sbGVjdGlvbiI6ImJsb29kX2dsdWNvc2UiLCJxdWVyeSI6IltcclxuICAgIHtcclxuICAgICAgICBcIiRtYXRjaFwiOiB7XHJcbiAgICAgICAgICAgIFwicGFydGljaXBhbnRJZFwiOiBPYmplY3RJZChcIjY0ODFiNWYyNzA1MDA2MzUzMmE0NjAyMVwiKVxyXG4gICAgICAgIH1cclxuICAgIH0sXHJcbiAgICB7XHJcbiAgICAgICAgXCIkbWF0Y2hcIjoge1xyXG4gICAgICAgICAgICBcImRhdGVcIjogeyBcIiRndFwiOiBJU09EYXRlKFwiMjAyMy0wNi0xNVQwMDowMDowMC4wMDBaXCIpIH1cclxuICAgICAgICB9XHJcbiAgICB9XHJcbl1cclxuIiwidGVtcGxhdGUtdGFncyI6e319LCJkYXRhYmFzZSI6MTI5fSwiZGlzcGxheSI6InRhYmxlIiwidmlzdWFsaXphdGlvbl9zZXR0aW5ncyI6e319

#aggregation #mongodb #date
star

Thu Apr 04 2024 17:09:21 GMT+0000 (Coordinated Universal Time) http://34.74.16.180:3000/question#eyJkYXRhc2V0X3F1ZXJ5Ijp7InR5cGUiOiJuYXRpdmUiLCJuYXRpdmUiOnsiY29sbGVjdGlvbiI6ImRpZXRMaWJyYXJ5IiwicXVlcnkiOiJbXHJcbiAgICB7XHJcbiAgICAgICAgXCIkbWF0Y2hcIjoge1xyXG4gICAgICAgICAgICBcIiRleHByXCI6IHtcclxuICAgICAgICAgICAgICAgIFwiJG5lXCI6IFtcIiRmb29kU3RhdHVzXCIsIFwiQVBQUk9WRURcIl1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgIH0sXHJcbiAgICB7XHJcbiAgICAgICAgXCIkbG9va3VwXCI6IHtcclxuICAgICAgICAgICAgXCJmcm9tXCI6IFwibWFzdGVybWVhbHBsYW5cIixcclxuICAgICAgICAgICAgXCJsb2NhbEZpZWxkXCI6IFwiZGlzaFZhcmlhdGlvblwiLFxyXG4gICAgICAgICAgICBcImZvcmVpZ25GaWVsZFwiOiBcIm1lYWxQbGFuLmRpc2hWYXJpYXRpb25cIixcclxuICAgICAgICAgICAgXCJhc1wiOiBcIm1lYWxEYXRhXCJcclxuICAgICAgICB9XHJcbiAgICB9LFxyXG4gICAge1xyXG4gICAgICAgIFwiJG1hdGNoXCI6IHtcclxuICAgICAgICAgICAgXCIkZXhwclwiOiB7XHJcbiAgICAgICAgICAgICAgICBcIiRndFwiOiBbeyBcIiRzaXplXCI6IFwiJG1lYWxEYXRhXCIgfSwgMF1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgIH0sXHJcbiAgICB7XHJcbiAgICAgICAgXCIkcHJvamVjdFwiOiB7XHJcbiAgICAgICAgICAgIFwibWVhbERhdGFcIjogXCIkbWVhbERhdGEucGxhbk5hbWVcIixcclxuICAgICAgICAgICAgXCJkaXNoVmFyaWF0aW9uXCI6IDFcclxuICAgICAgICB9XHJcbiAgICB9XHJcbl1cclxuIiwidGVtcGxhdGUtdGFncyI6e319LCJkYXRhYmFzZSI6Mn0sImRpc3BsYXkiOiJ0YWJsZSIsInZpc3VhbGl6YXRpb25fc2V0dGluZ3MiOnt9fQ==

#aggregation #mongodb #$push #exp
star

Fri Mar 22 2024 16:37:26 GMT+0000 (Coordinated Universal Time) http://34.74.16.180:3000/question#eyJkYXRhc2V0X3F1ZXJ5Ijp7InR5cGUiOiJuYXRpdmUiLCJuYXRpdmUiOnsiY29sbGVjdGlvbiI6ImNsaW5pY3MiLCJxdWVyeSI6IltcclxuICAgIHtcclxuICAgICAgICBcIiRtYXRjaFwiOiB7XHJcbiAgICAgICAgICAgIFwicGFydG5lclNob3J0Q29kZVwiOiB7XHJcbiAgICAgICAgICAgICAgICBcIiRpblwiOiBbXVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgfSxcclxuICAgIHtcclxuICAgICAgICBcIiRncm91cFwiOiB7XHJcbiAgICAgICAgICAgIFwiX2lkXCI6IFwiJHBhcnRuZXJTaG9ydENvZGVcIixcclxuICAgICAgICAgICAgXCJjbGluaWNzXCI6IHtcclxuICAgICAgICAgICAgICAgIFwiJHB1c2hcIjoge1xyXG4gICAgICAgICAgICAgICAgICAgIFwiY2xpbmljTmFtZVwiOiBcIiRuYW1lXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgXCJjbGluaWNJZFwiOiBcIiRfaWRcIlxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgfSxcclxuICAgIHtcclxuICAgICAgICBcIiRwcm9qZWN0XCI6IHtcclxuICAgICAgICAgICAgX2lkOjAsXHJcbiAgICAgICAgICAgIFwicGFydG5lclNob3J0Q29kZVwiOiBcIiRfaWRcIixcclxuICAgICAgICAgICAgXCJjbGluaWNzXCI6IDFcclxuICAgICAgICB9XHJcbiAgICB9XHJcbl1cclxuIiwidGVtcGxhdGUtdGFncyI6e319LCJkYXRhYmFzZSI6Mn0sImRpc3BsYXkiOiJ0YWJsZSIsInZpc3VhbGl6YXRpb25fc2V0dGluZ3MiOnt9fQ==

#aggregation #mongodb #$push
star

Tue Mar 19 2024 16:09:32 GMT+0000 (Coordinated Universal Time)

#aggregation #mongodb
star

Tue Mar 12 2024 14:39:42 GMT+0000 (Coordinated Universal Time) http://34.74.16.180:3000/question#eyJkYXRhc2V0X3F1ZXJ5Ijp7ImRhdGFiYXNlIjoyLCJuYXRpdmUiOnsidGVtcGxhdGUtdGFncyI6e30sInF1ZXJ5IjoiW1xyXG4gICAge1xyXG4gICAgICAgICRncm91cDoge1xyXG4gICAgICAgICAgICBfaWQ6IFwiJHBhcnRpY2lwYW50SWRcIixcclxuICAgICAgICAgICAgZG9jdW1lbnRzOiB7ICRwdXNoOiBcIiQkUk9PVFwiIH0sXHJcbiAgICAgICAgICAgIGNvdW50OiB7ICRzdW06IDEgfVxyXG4gICAgICAgIH1cclxuICAgIH0sXHJcbiAgICB7XHJcbiAgICAgICAgJG1hdGNoOiB7XHJcbiAgICAgICAgICAgIGNvdW50OiB7ICRndDogMSB9XHJcbiAgICAgICAgfVxyXG4gICAgfSxcclxuICAgIHtcclxuICAgICAgICAkdW53aW5kOiBcIiRkb2N1bWVudHNcIlxyXG4gICAgfSxcclxuICAgIHtcclxuICAgICAgICAkbWF0Y2g6IHtcclxuICAgICAgICAgICAgXCJkb2N1bWVudHMucHJvZ3JhbUNvZGVcIjogeyAkbmU6IFwiXCIgfVxyXG4gICAgICAgIH1cclxuICAgIH0sXHJcbiAgICB7XHJcbiAgICAgICAgJGdyb3VwOiB7XHJcbiAgICAgICAgICAgIF9pZDoge1xyXG4gICAgICAgICAgICAgICAgcGFydGljaXBhbnRJZDogXCIkX2lkXCIsXHJcbiAgICAgICAgICAgICAgICBwcm9ncmFtQ29kZTogXCIkZG9jdW1lbnRzLnByb2dyYW1Db2RlXCIsXHJcbiAgICAgICAgICAgICAgICBwcm9ncmFtU3RhcnREYXRlOiBcIiRkb2N1bWVudHMucHJvZ3JhbVN0YXJ0RGF0ZVwiXHJcbiAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgIGJhc2VsaW5lSWQ6IHsgJGZpcnN0OiBcIiRfaWRcIiB9LFxyXG4gICAgICAgICAgICBkb2N1bWVudElkczogeyAkcHVzaDogXCIkZG9jdW1lbnRzLl9pZFwiIH0sIFxyXG4gICAgICAgICAgICBkb2N1bWVudHM6IHsgJHB1c2g6IFwiJGRvY3VtZW50c1wiIH0sXHJcbiAgICAgICAgICAgIGNvdW50OiB7ICRzdW06IDEgfVxyXG4gICAgICAgIH1cclxuICAgIH0sXHJcbiAgICB7XHJcbiAgICAgICAgJG1hdGNoOiB7XHJcbiAgICAgICAgICAgIGNvdW50OiB7ICRndDogMSB9XHJcbiAgICAgICAgfVxyXG4gICAgfSxcclxuICAgIHtcclxuICAgICAgICAkcHJvamVjdDoge1xyXG4gICAgICAgICAgICBfaWQ6IDEsXHJcbiAgICAgICAgICAgIHBhcnRpY2lwYW50SWQ6IFwiJF9pZC5wYXJ0aWNpcGFudElkXCIsXHJcbiAgICAgICAgICAgIHByb2dyYW1Db2RlOiBcIiRfaWQucHJvZ3JhbUNvZGVcIixcclxuICAgICAgICAgICAgcHJvZ3JhbVN0YXJ0RGF0ZTogXCIkX2lkLnByb2dyYW1TdGFydERhdGVcIixcclxuICAgICAgICAgICAgYmFzZWxpbmVJZDogMSxcclxuICAgICAgICAgICAgZG9jdW1lbnRJZHM6IDEgXHJcbiAgICAgICAgfVxyXG4gICAgfSxcclxuICAgIHtcclxuICAgICAgICAkbG9va3VwOiB7XHJcbiAgICAgICAgICAgIFwiZnJvbVwiOiBcInBhcnRpY2lwYW50XCIsXHJcbiAgICAgICAgICAgIFwibG9jYWxGaWVsZFwiOiBcInBhcnRpY2lwYW50SWRcIixcclxuICAgICAgICAgICAgXCJmb3JlaWduRmllbGRcIjogXCJfaWRcIixcclxuICAgICAgICAgICAgXCJhc1wiOiBcInRlbXBcIlxyXG4gICAgICAgIH1cclxuICAgIH0sXHJcbiAgICB7XHJcbiAgICAgICAgJG1hdGNoOiB7XHJcbiAgICAgICAgICAgIFwidGVtcC51c2VyU3RhdHVzXCI6IHsgJG5lOiBcIlRFU1RcIiB9LFxyXG4gICAgICAgICAgICAkYW5kOiBbXHJcbiAgICAgICAgICAgICAgICB7IFwidGVtcC5lbWFpbFwiOiB7ICRuaW46IFsvZGVsZXRlZC9dIH0gfSxcclxuICAgICAgICAgICAgICAgIHsgXCJ0ZW1wXCI6IHsgJG5lOiBudWxsIH0gfVxyXG4gICAgICAgICAgICBdXHJcbiAgICAgICAgfVxyXG4gICAgfSxcclxuICAgIHtcclxuICAgICAgICAkdW53aW5kOlwiJGRvY3VtZW50SWRzXCJcclxuICAgIH1cclxuICAgIHtcclxuICAgICAgICAkcHJvamVjdDoge1xyXG4gICAgICAgICAgICBfaWQ6MFxyXG4gICAgICAgICAgICBcInBhcnRpY2lwYW50SWRcIjogeyAkYXJyYXlFbGVtQXQ6IFtcIiR0ZW1wLl9pZFwiLCAwXSB9LFxyXG4gICAgICAgICAgICBcImVtYWlsXCI6IHsgJGFycmF5RWxlbUF0OiBbXCIkdGVtcC5lbWFpbFwiLCAwXSB9LFxyXG4gICAgICAgICAgICBcImRvY3VtZW50SWRzXCI6IDEgXHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG5dXHJcbiIsImNvbGxlY3Rpb24iOiJwYXJ0aWNpcGFudEJhc2VsaW5lQW5kRm9sbG93dXBEYXRhIn0sInR5cGUiOiJuYXRpdmUifSwiZGlzcGxheSI6InRhYmxlIiwidmlzdWFsaXphdGlvbl9zZXR0aW5ncyI6e319

##jupyter #aggregation #mongodb
star

Fri Mar 08 2024 10:24:18 GMT+0000 (Coordinated Universal Time) http://34.74.16.180:3000/question#eyJkYXRhc2V0X3F1ZXJ5Ijp7ImRhdGFiYXNlIjoyLCJuYXRpdmUiOnsidGVtcGxhdGUtdGFncyI6e30sInF1ZXJ5IjoiW1xyXG4gICAge1xyXG4gICAgICAgIFwiJG1hdGNoXCI6IHtcclxuICAgICAgICAgICAgXCJlbWFpbFwiOiBcInByb2R1Y3RAc21pdC5maXRcIlxyXG4gICAgICAgIH1cclxuICAgIH0sXHJcbiAgICB7XHJcbiAgICAgICAgXCIkbG9va3VwXCI6IHtcclxuICAgICAgICAgICAgXCJmcm9tXCI6IFwidXNlcnNcIixcclxuICAgICAgICAgICAgXCJsb2NhbEZpZWxkXCI6IFwiZW1haWxcIixcclxuICAgICAgICAgICAgXCJmb3JlaWduRmllbGRcIjogXCJlbWFpbFwiLFxyXG4gICAgICAgICAgICBcImFzXCI6IFwidXNlckxrcFwiXHJcbiAgICAgICAgfVxyXG4gICAgfSxcclxuICAgIHtcclxuICAgICAgICBcIiR1bndpbmRcIjoge1xyXG4gICAgICAgICAgICBcInBhdGhcIjogXCIkdXNlckxrcFwiLFxyXG4gICAgICAgICAgICBcInByZXNlcnZlTnVsbEFuZEVtcHR5QXJyYXlzXCI6IHRydWVcclxuICAgICAgICB9XHJcbiAgICB9LFxyXG4gICAge1xyXG4gICAgICAgIFwiJG1hdGNoXCI6IHtcclxuICAgICAgICAgICAgXCJ1c2VyTGtwLnBvcnRhbFBhc3N3b3JkXCI6IFwic21pdEBwcm9kdWN0I0AxMjFcIlxyXG4gICAgICAgIH1cclxuICAgIH0sXHJcbiAgICB7XHJcbiAgICAgICAgXCIkcHJvamVjdFwiOiB7XHJcbiAgICAgICAgICAgIFwiZmlyc3ROYW1lXCI6IDEsXHJcbiAgICAgICAgICAgIFwibWlkZGxlTmFtZVwiOiAxLFxyXG4gICAgICAgICAgICBcImxhc3ROYW1lXCI6IDEsXHJcbiAgICAgICAgICAgIFwiZW1haWxcIjogMSxcclxuICAgICAgICAgICAgXCJtb2JpbGVcIjogMSxcclxuICAgICAgICAgICAgXCJyb2xlXCI6IDEsXHJcbiAgICAgICAgICAgIFwicGFydG5lclNob3J0Q29kZVwiOiAxLFxyXG4gICAgICAgICAgICBcInVzZXJHcm91cHNcIjogXCIkdXNlckxrcC51c2VyR3JvdXBzXCIsXHJcbiAgICAgICAgICAgIFwicHJvZmlsZVBpY3R1cmVVUkxcIjogMSxcclxuICAgICAgICAgICAgXCJwb3J0YWxQYXNzd29yZFwiOiBcIiR1c2VyTGtwLnBvcnRhbFBhc3N3b3JkXCIsXHJcbiAgICAgICAgICAgIFwiYXV0aG9yaXphdGlvblwiOiBcIiR1c2VyTGtwLmF1dGhvcml6YXRpb25cIlxyXG4gICAgICAgIH1cclxuICAgIH1cclxuXSIsImNvbGxlY3Rpb24iOiJ1c2VycyJ9LCJ0eXBlIjoibmF0aXZlIn0sImRpc3BsYXkiOiJ0YWJsZSIsInZpc3VhbGl6YXRpb25fc2V0dGluZ3MiOnt9fQ==

##jupyter #aggregation #mongodb
star

Fri Mar 01 2024 04:29:49 GMT+0000 (Coordinated Universal Time) http://34.74.16.180:3000/question#eyJkYXRhc2V0X3F1ZXJ5Ijp7InR5cGUiOiJuYXRpdmUiLCJuYXRpdmUiOnsiY29sbGVjdGlvbiI6InVzZXJBc3Nlc3NtZW50TWFwcGluZyIsInF1ZXJ5IjoiW1xuICAgIHtcbiAgICAgIFwiJGxvb2t1cFwiOiB7XG4gICAgICAgIFwiZnJvbVwiOiBcIkFzc2Vzc21lbnRcIixcbiAgICAgICAgXCJsb2NhbEZpZWxkXCI6IFwiYXNzZXNzbWVudElkXCIsXG4gICAgICAgIFwiZm9yZWlnbkZpZWxkXCI6IFwiX2lkXCIsXG4gICAgICAgIFwiYXNcIjogXCJhc3Nlc3NtZW50XCJcbiAgICAgIH1cbiAgICB9LFxuICAgIHtcbiAgICAgIFwiJHVud2luZFwiOiB7XG4gICAgICAgIFwicGF0aFwiOiBcIiRhc3Nlc3NtZW50XCIsXG4gICAgICAgIFwicHJlc2VydmVOdWxsQW5kRW1wdHlBcnJheXNcIjogdHJ1ZVxuICAgICAgfVxuICAgIH0sXG4gICAge1xuICAgICAgXCIkbWF0Y2hcIjoge1xuICAgICAgICBcIiRhbmRcIjogW1xuICAgICAgICAgIHtcbiAgICAgICAgICAgIFwiYXNzZXNzbWVudElkXCI6IHtcbiAgICAgICAgICAgICAgXCIkb2lkXCI6IFwiNjIyMDcyYjFhYWViNGU1OTU1MzE5MzA0XCJcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImVuZENvZGVcIjoge1xuICAgICAgICAgICAgICBcIiRuZVwiOiBcIlwiXG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICBdXG4gICAgICB9XG4gICAgfSxcbiAgIHtcbiAgXCIkcHJvamVjdFwiOiB7XG4gICAgXCJfaWRcIjogMSxcbiAgICBcIm5hbWVcIjoge1xuICAgICAgXCIkY29uZFwiOiB7XG4gICAgICAgIFwiaWZcIjogeyBcIiRpZk51bGxcIjogW1wiJGFzc2Vzc21lbnRUeXBlXCIsIGZhbHNlXSB9LFxuICAgICAgICBcInRoZW5cIjogXCIkYXNzZXNzbWVudFR5cGVcIixcbiAgICAgICAgXCJlbHNlXCI6IFwiSURSU1wiXG4gICAgICB9XG4gICAgfSxcbiAgICBcImFzc2Vzc21lbnRJZFwiOiBcIiRfaWRcIixcbiAgICBcIm9rXCI6IFwiJGFzc2Vzc21lbnQudHlwZVwiLFxuICAgIFwiY3JlYXRlZEF0XCI6IDFcbiAgfVxufVxuLFxuICAge1xuICAgICAgXCIkc29ydFwiOiB7XG4gICAgICAgIFwiY3JlYXRlZEF0XCI6IC0xXG4gICAgICB9XG4gICAgfVxuXG4gIF0iLCJ0ZW1wbGF0ZS10YWdzIjp7fX0sImRhdGFiYXNlIjoyfSwiZGlzcGxheSI6InRhYmxlIiwidmlzdWFsaXphdGlvbl9zZXR0aW5ncyI6e319

##jupyter #aggregation #mongodb
star

Fri Sep 29 2023 07:53:20 GMT+0000 (Coordinated Universal Time)

#mongodb #mongoose #express
star

Thu Aug 31 2023 02:05:11 GMT+0000 (Coordinated Universal Time)

#javascript #mongodb
star

Thu Aug 31 2023 00:36:19 GMT+0000 (Coordinated Universal Time)

#javascript #mongodb
star

Sat May 27 2023 12:34:09 GMT+0000 (Coordinated Universal Time) https://www.learmoreseekmore.com/2022/03/demo-on-mongodb-running-on-docker-and-visual-studio-code-mongodb-extension-playground.html

#javascript #mongodb
star

Sat May 27 2023 12:32:29 GMT+0000 (Coordinated Universal Time) https://www.learmoreseekmore.com/2022/03/demo-on-mongodb-running-on-docker-and-visual-studio-code-mongodb-extension-playground.html

#javascript #mongodb
star

Sat May 27 2023 12:31:59 GMT+0000 (Coordinated Universal Time) https://www.learmoreseekmore.com/2022/03/demo-on-mongodb-running-on-docker-and-visual-studio-code-mongodb-extension-playground.html

#javascript #mongodb
star

Sat May 27 2023 12:30:07 GMT+0000 (Coordinated Universal Time) https://www.learmoreseekmore.com/2022/03/demo-on-mongodb-running-on-docker-and-visual-studio-code-mongodb-extension-playground.html

#javascript #mongodb
star

Sat May 27 2023 12:19:04 GMT+0000 (Coordinated Universal Time) https://www.learmoreseekmore.com/2022/03/demo-on-mongodb-running-on-docker-and-visual-studio-code-mongodb-extension-playground.html

#mongodb #javascript
star

Wed May 03 2023 02:33:53 GMT+0000 (Coordinated Universal Time)

#kotlin #mongodb #graphql
star

Wed May 03 2023 02:30:29 GMT+0000 (Coordinated Universal Time)

#kotlin #mongodb
star

Tue May 02 2023 01:53:54 GMT+0000 (Coordinated Universal Time)

#mongoshell #mongodb #mongocli #mongo
star

Mon Mar 06 2023 11:15:56 GMT+0000 (Coordinated Universal Time)

#nodejs #mongoose #mongodb #aggregate
star

Thu Feb 16 2023 14:32:06 GMT+0000 (Coordinated Universal Time) https://github.com/Automattic/mongoose/issues/4832

#mongodb #getter #setter #virtual
star

Thu Feb 16 2023 11:39:22 GMT+0000 (Coordinated Universal Time) https://mongoosejs.com/docs/populate.html#populate-virtuals

#mongodb #virtual #populate
star

Thu Feb 16 2023 05:30:40 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/48305624/how-to-use-mongodb-aggregation-for-pagination

#aggregation #mongodb #pagination
star

Fri Aug 20 2021 16:12:21 GMT+0000 (Coordinated Universal Time)

#nodejs #mongoose #mongodb #aggregate
star

Thu Jul 15 2021 09:01:12 GMT+0000 (Coordinated Universal Time)

#mongodb #mongoose #nodejs
star

Wed Jun 30 2021 11:07:26 GMT+0000 (Coordinated Universal Time)

#nodejs #mongoose #mongodb #aggregate
star

Wed Jun 30 2021 11:05:27 GMT+0000 (Coordinated Universal Time)

#nodejs #mongoose #mongodb #aggregate
star

Sat Jun 19 2021 09:25:48 GMT+0000 (Coordinated Universal Time)

#nodejs #mongoose #mongodb #aggregate
star

Mon Jun 14 2021 12:21:17 GMT+0000 (Coordinated Universal Time) https://scotch.io/courses/create-a-crud-app-with-node-and-mongodb/a-mongoose-model

#express #nodej #mongodb #mongoose #slug #url
star

Fri Jun 11 2021 05:17:27 GMT+0000 (Coordinated Universal Time)

#nodejs #mongoose #mongodb #aggregate
star

Sun Jun 06 2021 15:41:09 GMT+0000 (Coordinated Universal Time) https://attacomsian.com/blog/mongoose-connect-async-await

#mongoose #mongodb #nodejs
star

Mon May 10 2021 10:21:30 GMT+0000 (Coordinated Universal Time)

#nodejs #mongoose #mongodb
star

Wed May 05 2021 03:22:48 GMT+0000 (Coordinated Universal Time)

#nodejs #mongoose #mongodb
star

Fri Apr 30 2021 12:17:40 GMT+0000 (Coordinated Universal Time)

#nodejs #mongoose #mongodb
star

Fri Apr 30 2021 12:17:39 GMT+0000 (Coordinated Universal Time)

#nodejs #mongoose #mongodb
star

Wed Jun 10 2020 12:20:30 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/38497650/how-to-find-items-using-regex-in-mongoose/38498075

#javascript #mongoose #mongodb #mean

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension