Ok, So initially my collection name was "product" so whenever I was inserting only name, it automatically creates a new collection but I changed it as "products" and now its fine. what was wroing if my collection name was product ?
What mongoose do is that, When no collection argument is passed, Mongoose produces a collection name by pluralizing the model name. If you don't like this behavior, either pass a collection name or set your schemas collection name option. Example: var schema = new Schema({ name: String }, { collection: 'actor' }); or schema.set('collection', 'actor'); or var collectionName = 'actor' var M = mongoose.model('Actor', schema, collectionName);
When i add data it made a new collection for product in same e com data base and in one product all previous data was saved and in another product only the entered data in this video was saved
because here we are initializing a new document in this code down below and pushing it to the db const data = new ProductsModel({name: "m8", price: 4000}); You can achieve the same with post method but there are just multiple ways to do the same thing
its fact for developer = mongoose take plural names for collections .....to take singular names...... var memberSchema = new Schema({..}, { collection: 'member' })................................no thanks ............................hehehehe
@@AngusMayer-i6w when we create collection name in mongoDB... by default it takes plural names...eg. ( users, blogs ) but when we want to take singular names only we have write some extra code new mongoose.schema({ #code... }),{ collection : "user" }; here if we focus on collection..it is singular....... baas yhi......any issue....contact me again..no problem...... no need of thanks....its my pleasure help you dear
well, whenever I'm inserting only name, it automatically creates a new collection with single "name" record. It's not inserting into same products collection, why @anil Please respond.
see @rukhsarfatma1194 reply, it resolved the issue. Use { collection: 'Products' } inside const ProductSchema= new mongoose.Schema({ name: String, email: String },{ collection: 'Products' })
I like the way you explain any topics for beginners even🤘
best course for beginners this playlist is real GEM of the UA-cam
Amazing palylist for learning node. explain in detail . Thank you so much.
respect for you sir
Your teaching skills are just amazing
Thanks a ton
thank you heartly sir amazing content for poor student ,you can help me a lot❣❣
Literally amazing playlist this is !!!!!!!!!!!!!!!!!!🤩🤩🤩🤩🤩🤩🤩🤩
Yr explanation is very useful and very much good 💐👍
Thank you... Very helpful
This course video is useful........
Please complete the series as soon as possible
Yes Sir, Please make video on crud operation also
Nidhu
very well taught
thanx u made it so easy
awesome video sir!!
Thank you sir
well explained
Good explanation
Thank u very much Sir
Hello Anil Sir, Can't we do this with schema validator?
Awesome
if data not inserted in database please create a new database & collections and run again I think it will properly...
bhai tu best hai
Ok, So initially my collection name was "product" so whenever I was inserting only name, it automatically creates a new collection but I changed it as "products" and now its fine. what was wroing if my collection name was product ?
Getting same issue
What mongoose do is that, When no collection argument is passed, Mongoose produces a collection name by pluralizing the model name. If you don't like this behavior, either pass a collection name or set your schemas collection name option.
Example:
var schema = new Schema({ name: String }, { collection: 'actor' });
or
schema.set('collection', 'actor');
or
var collectionName = 'actor'
var M = mongoose.model('Actor', schema, collectionName);
@@rukhsarfatma1194 thank you, this helped
@@rukhsarfatma1194 Thank you it Helped 😍
we can check and insert vaild data in MongoDB that way using mongoose ?
Can I use both Mongoose and MongoDB package at same time??
Sir what is the difference between your old node JS lecture series with this series?
Sir, please make a mini mean project
When i add data it made a new collection for product in same e com data base and in one product all previous data was saved and in another product only the entered data in this video was saved
running scripts is disabled on this system nodemon
sir ye error aa raha jb nodemon run krte hai to koi solution plz
why data is saving without the POST method?
because here we are initializing a new document in this code down below and pushing it to the db
const data = new ProductsModel({name: "m8", price: 4000});
You can achieve the same with post method but there are just multiple ways to do the same thing
sir yout git hub link is not founded
Sir my table name is Product and in product model I have enter Product only then why is it making new table as products
Sir please make a video on how to become a professional software developer without any computer science degree please sir
You tube par dekhle jake aur bahot logo ne is topic par video banaya hua he . Search to kar ek bar.
Pls make a mini project
👌👌👌👌👌👌
unable to get this code. Your git page not found.
Thnx u sir
Sir you will cover express JS and Mongo db in this node JS course?
We are already using express js
lecture 39 completed
Why collection is getting updated with __v: 0?
please make mern project sir
my data isnt storing in database. its popping on console . what cold be the possible reason. anyone?
you have to create new file or change the file name
i am facing error can anyone provide code if the following lecture please
I hope it works for u
its fact for developer = mongoose take plural names for collections .....to take singular names......
var memberSchema = new Schema({..}, { collection: 'member' })................................no thanks ............................hehehehe
kehna kya chahta hai bhai
@@AngusMayer-i6w
when we create collection name in mongoDB...
by default it takes plural names...eg. ( users, blogs )
but when we want to take singular names only we have write some extra code
new mongoose.schema({
#code...
}),{ collection : "user" };
here if we focus on collection..it is singular.......
baas yhi......any issue....contact me again..no problem......
no need of thanks....its my pleasure help you dear
well, whenever I'm inserting only name, it automatically creates a new collection with single "name" record. It's not inserting into same products collection, why @anil Please respond.
That's exactly what is happening with me as well.
see @rukhsarfatma1194 reply, it resolved the issue. Use { collection: 'Products' } inside const ProductSchema= new mongoose.Schema({
name: String,
email: String
},{ collection: 'Products' })
showing 404 on your github link
if any one got this error ---->> MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
try this for connect mongo :- mongodb://0.0.0.0
sir my data is poping in console but its not saving in Mongodb . why ??
same issue. isn't resolved yet :(
@@MuhammadSufyan-bz9mb re-check you connection , schema , db name and query as well
kindly specify the correct format for connecting database.?