Hello can any one help me
Answered
Cape lion posted this in #help-forum
Cape lionOP
need add login system and i cant connect moongoss db
111 Replies
Original message was deleted
Cape lionOP
i cant connect mongo db bro
@Cape lion i cant connect mongo db bro
Yellowfin tuna
can you provide a code snippet from your connection code?
@Yellowfin tuna can you provide a code snippet from your connection code?
Cape lionOP
import { MongoClient } from 'mongodb';
const uri = process.env.MONGODB_URI;
const options = {};
let client;
let clientPromise;
if (!process.env.MONGODB_URI) {
throw new Error('Please add your Mongo URI to .env.local');
}
if (process.env.NODE_ENV === 'development') {
if (!global._mongoClientPromise) {
client = new MongoClient(uri, options);
global._mongoClientPromise = client.connect().then(() => {
console.log('Connected to MongoDB');
return client;
});
}
clientPromise = global._mongoClientPromise;
} else {
client = new MongoClient(uri, options);
clientPromise = client.connect().then(() => {
console.log('Connected to MongoDB');
return client;
});
}
export default clientPromise;@Yellowfin tuna can you provide a code snippet from your connection code?
Cape lionOP
mongodb+srv://username:passowrd@cluster0.ob7hjg2.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
Spectacled bear
mate
are you autistic
@Spectacled bear are you autistic
Cape lionOP
what ??
Spectacled bear
you're on league
big boy aren't you
how much do you weigh
and height
"This Developer is so Hard for dev Games"
my dad works for Riot mate
you don't develop shit
Cape lionOP
bro you can stop tlaking
@Yellowfin tuna can you provide a code snippet from your connection code?
Cape lionOP
@Yellowfin tuna you can help me
Yellowfin tuna
try {
client = new MongoClient(uri, options);
clientPromise = client.connect().then(() => {
console.log('Connected to MongoDB');
return client;
}).catch((error) => {
console.error(error);
throw error;
});Spectacled bear
@Yellowfin tuna <@810529202772115466>
Cape lionOP
okay i will try
Spectacled bear
stupid Indian cunt
give me $5 for Rollbit
please
bc1qqa5ngtpx0tzpzn7y24n3zk959dkajwtl5ha00p
@Spectacled bear give me $5 for Rollbit
Yellowfin tuna
do you have a gambling addiction?
Spectacled bear
no mate
it's a hobby
Yellowfin tuna
true
Spectacled bear
are you trynna give a poor man $5
will turn into thousand dollar
and give percent
yes yes very good
Yellowfin tuna
i will need to see some proof that you are actually good you know
Spectacled bear
of course mate
let me send a face picture real quickly
@Cape lion js
import { MongoClient } from 'mongodb';
const uri = process.env.MONGODB_URI;
const options = {};
let client;
let clientPromise;
if (!process.env.MONGODB_URI) {
throw new Error('Please add your Mongo URI to .env.local');
}
if (process.env.NODE_ENV === 'development') {
if (!global._mongoClientPromise) {
client = new MongoClient(uri, options);
global._mongoClientPromise = client.connect().then(() => {
console.log('Connected to MongoDB');
return client;
});
}
clientPromise = global._mongoClientPromise;
} else {
client = new MongoClient(uri, options);
clientPromise = client.connect().then(() => {
console.log('Connected to MongoDB');
return client;
});
}
export default clientPromise;
Japanese jack mackerel
import mongoose from "mongoose";
const connectMongoDB = async() => {
try {
await mongoose.connect(process.env.MONGODB_URI);
console.log("Successfully Connected to MongoDB.");
} catch(error) {
console.log(error);
}
};
export default connectMongoDB;
const connectMongoDB = async() => {
try {
await mongoose.connect(process.env.MONGODB_URI);
console.log("Successfully Connected to MongoDB.");
} catch(error) {
console.log(error);
}
};
export default connectMongoDB;
and make ur .env file
should be enough
try to log online into ur atlas account
and add ur IP address
@Japanese jack mackerel and make ur .env file
Japanese jack mackerel
in ur .env file MONGODB_URI=
Spectacled bear
mongoose is stupid
useless cunt
switch to sql
that's what me and my demons do mate
@Spectacled bear switch to sql
Japanese jack mackerel
sql is more dumb
Spectacled bear
here's a picture of my wife
we gamble together
@Japanese jack mackerel sql is more dumb
Spectacled bear
it isn't buddy
it's actually safer
and works better
more functionality
fuck Mongo
and fuck Nextjs
@Japanese jack mackerel in ur .env file MONGODB_URI=
Cape lionOP
MONGODB_URI=mongodb+srv://username:password@cluster0.ob7hjg2.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
@Cape lion MONGODB_URI=mongodb+srv://username:password@cluster0.ob7hjg2.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
Japanese jack mackerel
did u connect to atlas online?
Spectacled bear
bro
r u all indians
Japanese jack mackerel
and add ur IP
Spectacled bear
can u get burned
u fucking jews
Japanese jack mackerel
bro shush
Yellowfin tuna
LOL
😭
@Spectacled bear it's actually safer
Japanese jack mackerel
How
Yellowfin tuna
tbf it is pretty safe if you do it right
Spectacled bear
mate
i could name a million reasons
@Cape lion MONGODB_URI=mongodb+srv://username:password@cluster0.ob7hjg2.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
Japanese jack mackerel
are u running it locally? if u are u can just connect without atlas or the cluster
Yellowfin tuna
are you even calling it?
@Cape lion not anything
Japanese jack mackerel
rename it to just .env
sec
ur problem might be elsewhere i dun see problem with code
Spectacled bear
retarded niggas
swear to allah
and buddha
ur freaking stupid
Yellowfin tuna
whoa
@Cape lion not anything
Japanese jack mackerel
if you are running locally u can just change ur .env to mongodb://localhost:27017/DBNAME
Spectacled bear
sorry ma'am
@Spectacled bear sorry ma'am
Yellowfin tuna
it's okay
does it work @Cape lion ?
Japanese jack mackerel
or do this thru atlas
Yellowfin tuna
is that mongos cloud thing?
Japanese jack mackerel
yea atlas if ur connecting thru cluster u need to add ur IP
Yellowfin tuna
oh interesting
Japanese jack mackerel
its for deployment
Yellowfin tuna
i don't really trust any cloud stuff
way better to have all the stuff on a vps
Japanese jack mackerel
its comes down to prefrences and Atlas is made by MongoDB
more trustworthy then microsoft spyware on windows
Yellowfin tuna
yes but you're not in control over the data
its on their servers
Yellowfin tuna
@Cape lion does it work?
@Yellowfin tuna <@810529202772115466> does it work?
Cape lionOP
how can i test this
@Yellowfin tuna
@Cape lion how can i test this
Yellowfin tuna
idk call the route
@Cape lion how can i test this
Japanese jack mackerel
Answer
Japanese jack mackerel
@Cape lion helpful?
@Japanese jack mackerel <@810529202772115466> helpful?
Cape lionOP
yea
its working
@Cape lion yea
Japanese jack mackerel
Glad to hear can u mark it as solution c:
@Japanese jack mackerel Glad to hear can u mark it as solution c:
Cape lionOP
bro you can help me for more one
@Cape lion bro you can help me for more one
Japanese jack mackerel
sure what u need?
@Japanese jack mackerel sure what u need?
Cape lionOP
priv