I am using schema.pre('save', function (next) { if (this.isModified('field')) { //do something } }); but I now need to use this same function isModi
I'm building a Mongoose schema for a dating app. I want each person document to contain a reference to all the events they've been to, where events is another
Is it possible to have nested schemas in mongoose and have a required validator on the children? Something like this: const userSchema = new mongoose.Schema({
The number is larger than 9223372036854775807 - too big for NumberLong, which is mongo's native 64-bit long type. What's the best way to do this/the best field
I'm creating a testing for my express app. The project has multiple test files. In each module the server instance is required at beforeEach() method and closed
The documentation here doesn't provide much of an explanation for why there are two different operations to accomplish the same thing, so I'm wondering what the
Suppose the mongodb document(table) 'users' is { "_id": "6065923bc5d509071857f6e6", "version": [ { "name": "1.1.0",
When I run the send route I have error: MongoError: Cannot call abortTransaction twice and MongoError: Cannot call abortTransaction after calling commitTransact
const serverS = await server.findOne({ guildID: message.guild.id }); serverS.settings[1]["links"] = true; serverS.save() The code I use ^^^^ So when it saves t
Discord.js 13.6.0 | Node.js 16.14.2 | Mongoose 6.2.3 I want to do so that my bot searches the database to see if the guild should be removed or added Example I
I have document containing lists. Lets say they are: [ { _id: 52b37432b2395e1807000008, name: ListA, order: 1, desc: 'More about List A' }, { _id:
I'm trying to switch to mongoose from using just the native mongodb and having some trouble. Connecting to the db as I did previously works fine: var db; var
I've created a React app where you can post vinyls you have in your collection. Now I've implemented a button that is able to remove the selected item from the
Can you populate an array in a mongoose schema with references to a few different schema options? To clarify the question a bit, say I have the following schem
I'm trying to find tours within a specific distance.here is my code exports.getTourWithin = catchAsync(async (req, res, next) => { const { distance, latlng
I am attempting to import a CSV using my mongoose modal and regardless of its size, I am importing the first 2 rows and then every other row. const fs = require
I am trying to connect to a Mongo app from my Node application using Mongoose. I have done this before on the same machine, but this time I am having a connecti
I have a schema in Mongoose that looks like this: const SocketDetailsUserSchema = new mongoose.Schema({ userId: String, socketValue: [{ id: St
Is there a way to delete all children of an parent in Mongoose, similar to using MySQLs foreign keys? For example, in MySQL I'd assign a foreign key and set it
I have tried to use Mongoose to send the list of all users as follows: server.get('/usersList', function(req, res) { var users = {}; User.find({}, fun