Hi Anil, You have created it before 2 years I must suggest that keep updating your code as it's not working with new norms of mongo just check out your video number 32 which is required for try catch error handling without handle error you can not execute as well as Need to make sure that your DB connection must should be close to execute your output.
guys if you are getting error like insert is not a function so change it to insertOne , your error will be fixed. It is because of new version of monogb .
sir agr hmko other collection pr work krna hoga to uske lie bhi alg file banani pdegi? in mongodb.js file, we can perform operations on only products collection please ans
ypeError: Cannot read properties of undefined (reading 'find') sir ye error bar bar aa rha h . mongodb se data ko receive hi nhi hone de rha h? iska koe solution btaye plzz sir g
Some time you use ; after function and sometimes not. First instance console.log(); . Please let me know is it required to use semicolon in each code line?
const result = await db.insertOne( {name:'node5', brand:'vivo', price:50000, category:'mobile'} ); i am not able to insert data in database using this help me to do it
Hello sir kya aap meri data fast get karne me hel karoge.. API kafi samay leta h data get karne me so API call kaise farst kare taki data palak jhapakte hi mil jay. Plz help me .
const dbConnect = require('./mongodb'); const insert = async()=>{ const data = await dbConnect(); const result = data.insertMany( [{name:'xyz',roll:152,year: "3nd"}, {name:'pronoy',roll:12,year: "2nd"}] ) console.log(result); } insert(); For insert one db --> "insertOne in replace of insertMany"
Bro meri if statement work nahi kar rahi hai please help const result = db.insertMany( [ {name:'node 5', brand:'vivo', price:320, category:'mobile'}, {name:'node 9', brand:'vivo', price:450, category:'mobile'}, {name:'node 14', brand:'vivo', price:750, category:'mobile'} ] ); // console.log(result);
if someone is this time, a update is in node ...change insert to insertOne and for multiple record insertMany........................no thanks ...........hehehe
Anyone watching now, insert is deprecated, hence for single insert use "insertOne" and for multiple use "insertMany".
Thnks bhai
Thanks Brother
Helpful++
Thanks bhai😢😢
yeah i find out after 5 tries
Sir aap itta achha padhate ho ki apko bolne ki bhi zaroorat nhi hai subscribe krne ki...log khud hi kr denge
Perfect tutorial
Hi Anil, You have created it before 2 years I must suggest that keep updating your code as it's not working with new norms of mongo just check out your video number 32 which is required for try catch error handling without handle error you can not execute as well as Need to make sure that your DB connection must should be close to execute your output.
use insertOne() and insertMany() for insert data if anyone facing an error while inserting
thank you so much sir ,your explainaaton is too good
right bro
Thank you brother
your teaching style is superb...
Use insertOne() / insertMany() in place of insert().
i was also thinking for the same
finally, I got a clear explanation of all these things. Really thankful to u
guys if you are getting error like insert is not a function so change it to insertOne , your error will be fixed. It is because of new version of monogb .
thanks
Thenks Bhai😂
your Node js Playlist Awesome💯👍
If error in insertion --- use insertOne() for single object and insertMany() for array.
Thanku brother, you are a life saver.
thanks man
thank you bro attempted the code so many times but i got error its really helped to get ahead of this topic
@@jordaarfactsinhindi6616 your welcome
sir, your explanation so clear , salute sir thank you so much
Thanks for the wonderful explanation.
So nice
sir agr hmko other collection pr work krna hoga to uske lie bhi alg file banani pdegi?
in mongodb.js file, we can perform operations on only products collection
please ans
yes bro, but i would suggest to return database connection promise from mongodb.js
ypeError: Cannot read properties of undefined (reading 'find')
sir ye error bar bar aa rha h . mongodb se data ko receive hi nhi hone de rha h? iska koe solution btaye plzz sir g
if someone is facing issue with insert()
use insertOne() instead of insert()
khub valo
salute sir thank you so much
how to insert data in mongodb that expires after a certain time. ???
Some time you use ; after function and sometimes not. First instance console.log(); . Please let me know is it required to use semicolon in each code line?
awesome video
Sir data inserted nahi aa rha h mre console me. Bas jo data mongodb compass m pada hua h pehle se wahi show kr rha h.
Kya solution h iska??
hame bhi batao agar solve hua ho to
const insertOne = async () => {
const db = await dbConnect();
const result = db.insertOne(
{ name: "note 5", brand: "Redmi", price: 25000,category:'mobile' }
);
};
insertOne();
Why is this for ??
@@me_sumit_0 there was an update regarding data insertion they want simple query code for execution
thnks
Thanks bro
thanks bro
well explained
Sir my db.insert not working it shows error
db.insert is not a function plz help sir
🙏
user db.insertOne({})
Awesome
Great ❤❤❤
const result = await db.insertOne(
{name:'node5', brand:'vivo', price:50000, category:'mobile'}
);
i am not able to insert data in database using this help me to do it
good
Good video
excellent
Awesome bro
Good
Sir Please Start with React JS...???
react js course is already upload
Hello sir kya aap meri data fast get karne me hel karoge..
API kafi samay leta h data get karne me so API call kaise farst kare taki data palak jhapakte hi mil jay.
Plz help me .
Bro could you plz do one video on how to get data from mongodb collection and insert same data into MySQL db
for multiple insert use 'insertMany' in the place of 'insert'
lecture 32 completed
Sir mere case m only m insertOne iske through hi insert kra pa rha
Thanks Sir
yaar insert use karne ki kya zaroorat hai interone ya phir insertmany use karlo na
const dbConnect = require('./mongodb');
const insert = async()=>{
const data = await dbConnect();
const result = data.insertMany(
[{name:'xyz',roll:152,year: "3nd"},
{name:'pronoy',roll:12,year: "2nd"}]
)
console.log(result);
}
insert();
For insert one db --> "insertOne in replace of insertMany"
Thanks
😀😀😀😀
Bro meri if statement work nahi kar rahi hai please help
const result = db.insertMany(
[
{name:'node 5', brand:'vivo', price:320, category:'mobile'},
{name:'node 9', brand:'vivo', price:450, category:'mobile'},
{name:'node 14', brand:'vivo', price:750, category:'mobile'}
]
);
// console.log(result);
if(result.acknowledged){
console.log("data inserted");
}
Thanks Bhai...
thank you bro 🤗🤗
welcome all :)
updation
const dbConnect=require('./mongodb');
const insert=async()=>{
try{
const db=await dbConnect();
const result=await db.insertOne(
{name:'note 5', brand:'oneplus',price:320,category:'mobile'}
)
console.log(result)
}catch(err){
console.log("ERROR ",err)
}
}
insert();
this will work
const db=await main();
^
TypeError: main is not a function
i got this error how solve..p
sir my local host website is not working
sir laravel learning best book bty
TypeError: db.insertDb is not a function
i am getting error....pls help
use insertOne for one object and insertMany for more than one object
Ab ye jo same data k multiple entries ho rhi h ese kese roke koi tutorial h kyu k same data ka multiple entry to memory waste h. Ese kese roka jay
fun me insertone ki jagah insert many karo
db.insert is not a function ...I got this reply on nodemon
Sir showing db.insert is not a function
use db.insertone.
❤❤❤❤❤
Use insertOne And insertMany instead of insert
Sir not able to insert data
❤
❣❣❣❣❣❣❣❣❣❣
Noice
Giving errror dbConnect() is not a function
if someone is this time, a update is in node ...change insert to insertOne and for multiple record insertMany........................no thanks ...........hehehe
const dbConnect=require('./mongodb');
const arrayOFProduct=[
{name:'G20', brand:'moto',price:230,category:'mobile'},
{name:'M98', brand:'samsung',price:400,category:'mobile'},
{name:'AceAspire', brand:'asus',price:450,category:'mobile'},
{name:'ROG5', brand:'asus',price:700,category:'mobile'},
]
const insert=async()=>{
try{
const db=await dbConnect();
// const result=await db.insertOne(
// {name:'LAVAG%', brand:'lava',price:100,category:'mobile'}
const result=await db.insertMany(arrayOFProduct);
console.log(result);
console.log("DATA INSERTED")
}catch(err){
console.log("ERROR ",err)
}
}
insert();