How to remove one element from an array when there can be multiple entries of the same element?

The CartItems field has products of the same type I want to remove just one entry of the product but my code removes all the entries as the filter is satisfied by all the products.

public class ProductCarted
        public string? Id { get; set; }

        public int SecondID { get; set; }
        public string Title { get; set; } = null!;
        public string Description { get; set; } = null!;
        public int Price { get; set; }
        public double DiscountPercentage { get; set; }
        public double Rating { get; set; }
        public string Brand { get; set; } = null!;
        public string Category { get; set; } = null!;
        public string Thumbnail { get; set; } = null!;
        public string[] Images { get; set; } = null!;
public class Cart
        public string? SessionId { get; set; }
        public List<ProductCarted> CartItems { get; set; } = new List<ProductCarted>();
public async Task<UpdateResult> RemoveOneProduct(string sessionId, ProductCarted p)
        var filter = Builders<Cart>.Filter.Eq(c => c.SessionId, sessionId);
        var update = Builders<Cart>.Update.PullFilter(c => c.CartItems, ci => ci.Id == p.Id);
        var res = await _cartsCollection.UpdateOneAsync(filter, update);
        return res;

Hello and welcome to the community, @Syed_Uzair

Could you kindly assist me in understanding the question, if you are attempting to remove an item from the cart and the above code snippet causes you to remove all items from the cart?

If so, could you perhaps supply a sample document with the cart’s elements and a self-contained code that might aid in recreating the problem?

Could you also give the MongoDB and Driver versions for the above issue?