How to connect mongodb with meteor - meteor

I try to connect the mongodb with meteor app..But its not connecting. I place this code in settings.Json to connect with db
"env":{
"MONGO_URL":"mongodb://localhost:27017/wesendit"
},

You can use the following MONGO_URL syntax to connect the database
export MONGO_URL=mongodb://localhost:27017/database
To connect with authentication
export MONGO_URL='mongodb://username:password#domain.com:database/'

Related

Cannot connect Planetscale DB to NextJS project (Prisma Error: P1001)

Project architecture
Background
Trying to connect a DB to my NextJS project. Decided to use https://www.mockaroo.com/ to generate mock DB. Then used the Planetscale browser console to create the table and insert the values with the SQL generated by mockaroo.
Successfully have a table in Planetscale
Problem
When doing npx prisma studio
ERROR
Message: Error in Prisma Client request:
Invalid `prisma.mOCK_DATA.findMany()` invocation:
Can't reach database server at `us-east.connect.psdb.cloud`:`3306`
Please make sure your database server is running at `us-east.connect.psdb.cloud`:`3306`.
When doing npx prisma db pull
ERROR
Prisma schema loaded from prisma\schema.prisma
Environment variables loaded from .env
Datasource "db": MySQL database "MydbName" at "us-east.connect.psdb.cloud:3306"
✖ Introspecting based on datasource defined in prisma\schema.prisma
Error: P1001
Please make sure your database server is running at `us-east.connect.psdb.cloud`:`3306`.
scheme.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
referentialIntegrity = "prisma"
}
.env
DATABASE_URL="mysql://{username}:{password}#us-east.connect.psdb.cloud:3306/MydbName"
Summary
I cannot connect to the Planetscale DB from my NextJS project without an ERROR connecting. I have researched this issue online and found people with the issue. But applying their changes did not fix anything i.e. https://github.com/prisma/prisma/issues/5132. For instance I tried appending ?ssl_mode=require&sslcert==us-east-1-bundle.pem to the DATABASE_URL but no changes.
I will attempt this fix soon: How do I connect to a server with SSL from node.js on localhost?

Prisma: Error querying the database: db error: FATAL: too many connections

I am using Prisma as ORM in my nextjs app. I am initiating the Prisma client in a lib file and importing the same where ever i need the instance. But still am getting the following error.
Error querying the database: db error: FATAL: too many connections for
role "qcjoaamjgbnxjx"
prisma-client:
import { PrismaClient } from '#prisma/client';
const prisma = new PrismaClient();
export default prisma;
You could try instantiating PrismaClient as shown here so that a new connection isn't created on every reload.
I got the same error in my local computer. but my error was due to I have opened too many panels in pgAdmin. my database is Postgres. after removing all panels. my issue is solved

How to connect to postgres read replica in Hasura

I have the main postgres database running with Hasura. I want to add a new Hasura service that connects only to the read replica.
But it is getting this error
..."hint":"You can use REPEATABLE READ instead.","message":"cannot use serializable mode in a hot standby","status_code":"0A000"...
I also tried adding --tx-iso=repeatable-read but no luck.

Unable to connect to cosmos db emulator

I am using Azure Document Db version 2.6 and I am unable to connect to Cosmos Db emulator. I am trying to connect to https://localhost:8081. I am getting below error after it executes this line:
// Open the connection
documentClient.OpenAsync().GetAwaiter().GetResult();
WebException: The remote name could not be resolved:
'localhost-eastus2euap'
I am not sure how it's connecting to this url "localhost-eastus2euap" when I am trying to connect to localhost:8081
It looks like you are adding regions to the ConnectionPolicy PreferredLocations, is that correct?
When working with the emulator, adding regions is not supported, there are no regions as it is running in an isolated environment.
If this is code that hits the emulator or a live account, some configuration might be added to know when to add the regions and when not to.

Connecting meteorjs app to atlas mongodb having error could not locate valid servers

I am trying to connect my Meteor application to Atlas MongoDB,
I am setting MONGO_URL and MONGO_OPLOG_URL as follows:
MONGO_URL="mongodb://username:password#host:27017,host:27017,host:27017/databasename?ssl=true&replicaSet=melee-shard-0&authSource=admin"
MONGO_OPLOG_URL="mongodb://username:password#host:27017,host:27017,host:27017/local?ssl=true&replicaSet=melee-shard-0&authSource=admin"
But, I am getting error while starting the Meteor app:
Error: Could not locate any valid servers in initial seed list
What am I doing wrong?

Resources