You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I store Stripe subscription into my User document. Users has a subscription embed document which has a stripeSubscription hash, which is the json provided by Stripe
Here is my mapping:
#[MongoDB\Document(collection: 'users', repositoryClass: UserRepository::class)]
class User
{
#[MongoDB\EmbedOne(targetDocument: Subscription::class)]
protected Subscription $subscription;
So my ->field("subscription.stripeSubscription.id") is converted to subscription.stripeSubscription._id with _id instead of id and it does not find my user.
Am I missing something here ? Is there an option to filter with a field containing .id without rewriting to ._id ?
Edit: I found a workaround, it's not perfect as it does 2 queries (one to find it and the other one to return an hydrated Document) but it does work:
Support Question
I am using this lib with DoctrineMongoDBBundle.
I store Stripe subscription into my User document. Users has a
subscription
embed document which has astripeSubscription
hash, which is the json provided by StripeHere is my mapping:
Here is a sample of my User document:
I want to fetch users by
subscription.stripeSubscription.id
so I did:But in the profiler, the formatted query is:
So my
->field("subscription.stripeSubscription.id")
is converted tosubscription.stripeSubscription._id
with_id
instead ofid
and it does not find my user.Am I missing something here ? Is there an option to filter with a field containing
.id
without rewriting to._id
?Edit: I found a workaround, it's not perfect as it does 2 queries (one to find it and the other one to return an hydrated Document) but it does work:
The text was updated successfully, but these errors were encountered: