mongoose Questions
21
C:\Users\Nick\Desktop\turntablefm\Bots\Super Bot>node bot.js
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'mongoose'
at Function...
Etheline asked 24/12, 2011 at 6:54
2
I have a NodeJs API hosted on cyclic. Everything worked fine earlier but I exhausted my free tier API request and my app was suspended, then had to upgrade. Since then I have been having this error...
3
Here's my model:
'use strict';
var nested = new Schema({
name: String
});
var test = new Schema({
url : {
type : String,
// First validation
validate : [validator.isURL, 'Invalid URL']
},
...
3
I am using MongoDB Atlas cloud(https://cloud.mongodb.com/) and Mongoose library.
I tried to create multiple documents using transaction concept, but it is not working.
I am not getting any error. ...
Trichloride asked 22/11, 2018 at 17:8
7
Solved
I have a Schema that has a property with the type of array of strings that are predefined.
This is what I've tried to do:
interests: {
type: [String],
enum: ['football', 'basketball', 'read'],
r...
2
Solved
I'm trying to add a subdocument to a parent schema with Mongoose and MongoDB however I'm being thrown the following error:
TypeError: User is not a constructor
This is based off Mongoose's docum...
Robbi asked 23/11, 2016 at 22:11
4
Solved
In reservation system, only 5 different user can create bookings. If 100 user call booking api at same time than how to handle concurrency with locking. I am using nodejs with mongodb. I went throu...
Rriocard asked 18/9, 2021 at 18:10
11
Solved
I'm trying to connect to the database, seems like the set-up is correct, but for some reason, it says that it is not available.
app.module.ts
import { Module } from "@nestjs/common"
impor...
Phosphorous asked 16/1, 2022 at 13:32
6
Solved
I have the following model for mongoose.model('quotes'):
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var quotesSchema = new Schema({
created: { type: String, default: momen...
4
Solved
MongooseError: Cannot populate path loaned_to because it is not in your schema. Set the strictPopulate option to false to override.
I've tried to join two documents in mongodb using mongoose in nod...
23
Solved
My code was working before initially but I don't know why it just stopped working and gave me this error:
MongooseError: Operation `users.findOne()` buffering timed out after 10000ms
at Timeout.&l...
21
I am new to node.js, so I have a feeling that this will be something silly that I have overlooked, but I haven't been able to find an answer that fixes my problem. What I'm trying to do is create a...
2
Solved
I would like to run following query:
Group.find({program: {$in: [...]}}).lean().select('_id')
And then NOT get following back:
[{_id: ...}, {_id: ...}, {_id: ...}, {_id: ...}]
BUT following:
[......
3
Solved
I have a web application running on Node, express and MongoDB. I use mongoose as the ODM. When i tested my application with mongodb version v3.0.1 it runs fine and throws no errors. But when i run ...
3
My goal is to populate certain fields in mongoosastic search, but if I do the following codes, it will always return
Here's the code
var mongoose = require('mongoose');
var Category = require('...
Phip asked 3/2, 2016 at 16:55
6
I use macOS monterey (intel). I tried installing mongodb manually. Same problem. I used homebrew to install [email protected]. Same problem.
Nomatter what I try. I get this error. Please help!...
22
Solved
I'm using the MEAN stack and when I try to start the server using npm start, I get an exception saying that:
schema hasn't been registered for model 'Post'. Use mongoose.model(name, schema)
Here i...
15
Solved
With this help, I created a super user in the mongo shell: Create Superuser in mongo
user: "try1"
passw: "hello"
In mongo cmd, I have 3 databases: 'admin', 'myDatabase' and 'local'.
Now I try t...
5
Solved
When I send data from frontend to backend via API request I got this error:
Class constructor ObjectId can not be invoked without 'new' in mongoose,
I tried to convert into string and also into i...
4
Solved
I define a Person and Story schemas :
@Schema()
export class Person extends Document {
@Prop()
name: string;
}
export const PersonSchema = SchemaFactory.createForClass(Person);
@Schema()...
Aeolis asked 18/7, 2020 at 19:49
17
I'm facing this weird issue in NodeJS when using with Passport.js, Express and Mongoose. Basically, I get an error saying "Cannot set headers after they are sent to the client" even though I don't ...
Shiv asked 31/8, 2018 at 20:32
5
Solved
Quick code:
var userSchema = new mongoose.Schema({
username: String,
password: {type: String, select: false}
});
userSchema.methods.checkPassword = function(password, done) {
console.log(passw...
9
Solved
I found the following script:
Device.find(function(err, devices) {
devices.forEach(function(device) {
device.cid = '';
device.save();
});
});
MongoDB has the "multi" flag for an upda...
13
I can connect to the DB through terminal, but getting this error using mongoose and gulp.
mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:246
MongoError: auth failed
My connection st...
Interchangeable asked 7/5, 2015 at 15:42
1
I want to populate the fields of a subdocument, which is a discriminated element of a common Schema (Notificationable discriminated into Message or FriendRequest).
This question is quite similar ...
Parsnip asked 8/11, 2017 at 10:33
© 2022 - 2024 — McMap. All rights reserved.