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' })
best course for beginners this playlist is real GEM of the RUclips
I like the way you explain any topics for beginners even🤘
Literally amazing playlist this is !!!!!!!!!!!!!!!!!!🤩🤩🤩🤩🤩🤩🤩🤩
respect for you sir
Your teaching skills are just amazing
Thanks a ton
Amazing palylist for learning node. explain in detail . Thank you so much.
thank you heartly sir amazing content for poor student ,you can help me a lot❣❣
Thank you... Very helpful
Yr explanation is very useful and very much good 💐👍
This course video is useful........
Yes Sir, Please make video on crud operation also
Nidhu
very helpful
very well taught
thanx u made it so easy
awesome video sir!!
well explained
Please complete the series as soon as possible
Thank you sir
Good explanation
thanku sir
Awesome
bhai tu best hai
if data not inserted in database please create a new database & collections and run again I think it will properly...
Thank u very much Sir
👌👌👌👌👌👌
Hello Anil Sir, Can't we do this with schema validator?
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 😍
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
Can I use both Mongoose and MongoDB package at same time??
we can check and insert vaild data in MongoDB that way using mongoose ?
running scripts is disabled on this system nodemon
sir ye error aa raha jb nodemon run krte hai to koi solution plz
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 what is the difference between your old node JS lecture series with this series?
sir yout git hub link is not founded
Thnx u sir
Sir, please make a mini mean project
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
unable to get this code. Your git page not found.
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.
Sir you will cover express JS and Mongo db in this node JS course?
We are already using express js
Pls make a mini project
Why collection is getting updated with __v: 0?
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
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
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' })
lecture 39 completed
i am facing error can anyone provide code if the following lecture please
I hope it works for u
please make mern project sir
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.?