skip to Main Content

Search MongoDB autocomplete filtered

I want to search autocomplete on the following fields :contactfirstname, contactlastname and name Also, want to filter based on userid(s) first then perform autocomplete search Issue: Without filter criteria, autocomplete is working fine With filter criteria in compound query not…

VIEW QUESTION

Get an element from an array of objects with an id in mongodb using nodejs and mongoose

I've a many documents like this user:62e13ae4f9a38f7610e70bd7, _id :62e13ae4f9a38f7610e70bdb transactions:{ { "amount": 50, "category": "Bills", "type": "Expense", "date": "2022-01-20T00:00:00.000Z", "_id": "62e13ae4f9a38f7610e70be0" }, { "amount": 100, "category": "Lottery", "type": "Income", "date": "2022-01-20T00:00:00.000Z", "_id": "62e13ae4f9a38f7610e70be1" }, { "amount": 200, "category": "Salary", "type":…

VIEW QUESTION

What is MongoDB aggregate pipeline?

Using Mongoose driver Consider the following code : Connecting to database const mongoose = require("mongoose"); require("dotenv").config(); mongoose.connect(process.env.DB); const userSchema = new mongoose.Schema({ name: String }, {collection: 'test'}); const Model = mongoose.model('test', userSchema); Creating dummy document async function createDocs() { await…

VIEW QUESTION

Display data from another collection in MongoDB

I have two separate collection in MongoDB 1-> Post, 2-> Comment. Post-schema: const postSchema = new mongoose.Schema( { userId: { type: mongoose.Schema.Types.ObjectId, ref: "User", required: true, }, media: { type: [mongoose.Schema.Types.Mixed], trim: true, required: true, }, text: String, mentions: {…

VIEW QUESTION
Back To Top
Search