skip to Main Content

Unable to access data from mongoDB?

I followed a tutorial, connected to mongoDB via mongoose, but for some reason the console.log(data) doesn't show anything. const mongoose = require('mongoose'); const mongoURI = 'mongodb+srv://gofood:[email protected]/?retryWrites=true&w=majority' process.on('uncaughtException', err => { console.log('UNCAUGHT EXCEPTION! 💥 Shutting down...'); console.log(err.name, err.message); process.exit(1); }); async…

VIEW QUESTION

Constructing a MongoDB query to emulate JavaScript filtering logic (filter+every) using Mongoose for multiple search terms

Introduction I am building a search feature using mongodb with mongoose ODM. The codebase is already having an search feature using javascript. The code terms.every((term) => { const cleanedTerm = term.trim(); return ( usernameLower.includes(cleanedTerm) || nameLower.includes(cleanedTerm) || userTagsString.includes(cleanedTerm) || userLocationString.includes(cleanedTerm)…

VIEW QUESTION
Back To Top
Search