T3 Stack Using MongoDB

I can't seem to find a repo that uses T3 and MongoDB. Could anyone link a repo? Thanks!
6 Replies
Yiannis
Yiannis2y ago
I’m a massive beginner myself but I can see that Theo and the folks behind this stack really are against using mondgo db, and after seeing their explanations I’m inclined to agree. Here is the video. Watch it all properly and I think you will see why you shouldn’t use it. If you still wanna use it after you watch then I can’t help, above my grade for sure
Yiannis
Yiannis2y ago
Theo - t3․gg
YouTube
Did I Pick The Right Database???
Databases are scary. Picking the right one is scarier. I hope this helps. Please don't use Firestore. BECOME A MEMBER IF U LOVE ME: https://www.youtube.com/channel/UCbRP3c757lWg9M-U7TyEkXA/join Also check me out on other things, like Twitter https://twitter.com/t3dotgg And everything else: https://t3.gg/links Idez you are a legend thank you s...
cje
cje2y ago
all you have to do is change the db provider to mongodb
cje
cje2y ago
GitHub
vocab-learn-order-t3/schema.prisma at main · c-ehrlich/vocab-learn-...
Determine the optimal order to learn vocabulary and find sample sentences (rebuilt with tRPC) - vocab-learn-order-t3/schema.prisma at main · c-ehrlich/vocab-learn-order-t3
gabagoolo
gabagoolo2y ago
export const exampleRouter = router({
hello: publicProcedure
.input(z.object({ text: z.string().nullish() }).nullish())
.query(({ input }) => {
return {
greeting: `Hello ${input?.text ?? "world"}`,
};
}),
getByName: publicProcedure
.input(z.string())
.query(async ({ ctx, input }) => {
console.log(input)
return await ctx.prisma.apartment.findMany({
where: {
name: input
},
});

}),
});
export const exampleRouter = router({
hello: publicProcedure
.input(z.object({ text: z.string().nullish() }).nullish())
.query(({ input }) => {
return {
greeting: `Hello ${input?.text ?? "world"}`,
};
}),
getByName: publicProcedure
.input(z.string())
.query(async ({ ctx, input }) => {
console.log(input)
return await ctx.prisma.apartment.findMany({
where: {
name: input
},
});

}),
});
model Apartment {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String @unique
address String @unique
}
model Apartment {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String @unique
address String @unique
}
This is a sort of separate question but it's related to prisma and mongo. I'm basically trying to fetch a document item by name in my mongodb but on the frontend I'm getting null for the data fetched. I didn't seed the mongodb I just wrote some dummy data in it but I can't fetch it. Does this have something to do with the name of the collection? How does prisma know which collection to look for? Btw thanks for the repo cje
gabagoolo
gabagoolo2y ago
On the frontend I'm just calling with
const testing = trpc.example.getByName.useQuery("mock_name");
const testing = trpc.example.getByName.useQuery("mock_name");
Want results from more Discord servers?
Add your server