How to properly have one-to-one relation in MongoDB without any cons?

How to properly have one-to-one relation in MongoDB without any cons?

I am working on a project and have these two MongoDB collections, team (holding the details of teams) and payment (holding the payment of the teams) (strictly 1-1 relationship).

I am working on a project and have these two MongoDB collections, team (holding the details of teams) and payment (holding the payment of the teams) (strictly 1-1 relationship).

Payment Schema
{
    ...
    team: { type: Schema.Types.ObjectId, ref: 'Team', unique: true },
    ...
}

For Team, I have two alternatives:

Team1 Schema
{
    user_id: { type: Schema.Types.ObjectId, ref: 'User' }
}

...

Team2 Schema
{
    user_id: { type: Schema.Types.ObjectId, ref: 'User' }
    payment: { type: Schema.Types.ObjectId, ref: 'Payment', unique: true }
}

NEED: I have a component "My Teams" where I need to show logged-in user's all teams and his payment status (yes/no).

ISSUE WITH Team1 Schema: Since I do not have reference to Payment so I need to make another call to backend with team's _id to get Payment object for every team. If a user has 10 teams then it will be 11 backend calls (1 for teams, next 10 for their payment statuses).

ISSUE WITH Team2 Schema: Since I now have Payment _id inside the Team2 Schema so I can simply check if that field exist or not to determine if it's paid or not. But now the issue is, when a payment is made, I need to update both of Collections and need to use Transactions (to rollback in case any fails) which increases complexity and is also not support unless I have replica sets set upped.

Can you please help me figuring out this the best way possible?

Thanks in advance.

mongodb big-data

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Big Data can be The ‘Big’ boon for The Modern Age Businesses

We need no rocket science in understanding that every business, irrespective of their size in the modern-day business world, needs data insights for its expansion. Big data analytics is essential when it comes to understanding the needs and wants of a significant section of the audience.

How you’re losing money by not opting for Big Data Services?

Big Data Analytics is the next big thing in business, and it is a reality that is slowly dawning amongst companies. With this article, we have tried to show you the importance of Big Data in business and urge you to take advantage of this immense...

Data Lakes Are Not Just For Big Data - DZone Big Data

A data expert discusses the three different types of data lakes and how data lakes can be used with data sets not considered 'big data.'

How Big Data Analytics can effectively revolutionize eCommerce Businesses?

Learn how Big Data Analytics helps eCommerce businesses to use data more effectively for improving user engagement, increase sales, and better ROI.

Big Data and Business Intelligence: Transforming Business Dimensions

Learn how Big Data and Business Intelligence, both technologies helps the decision makers to make proper decisions that can help the organization to get advantages over their peers.