title: FirebaseError: Function setDoc() called with invalid data. Unsupported field value: undefined
body: <p><a href="https://i.stack.imgur.com/dR52G.png" rel="nofollow noreferrer">OrderDetails Logged image</a></p>
  <p>I want to save order details to my firestore db,Here my orderDetails:</p>
  <pre><code>const orderDetails=[{
                        id:&quot;ID1&quot;,
                        name:&quot;foo&quot;
                       },
                       {
                       id:&quot;ID2&quot;,
                       name:&quot;foo-foo&quot;
                       },
                       ]
  </code></pre>
  <p>Here is the code for adding this order Details to fire store:</p>
  <pre><code> .then(({paymentIntent})=&gt;{
    if(user){
      console.log(basket);
      const userRef=doc(db,'shopDB',user.uid);
      const userOrderRef=doc(userRef,'userOrderInfo',paymentIntent.id);
      setDoc(userOrderRef,{
        orders: basket,
        created :paymentIntent.created,
        amount :paymentIntent.amount
     },{merge:true})
  </code></pre>
  <p>Here all working if i set document without orderDetails,Other two values will added to fire store,but when i try to add orders to database it throws error</p>
  <p>error&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;</p>
  <pre><code> FirebaseError: Function setDoc() 
   called with invalid data. Unsupported
   field value: undefined
  </code></pre>
  <p>Can anyone help me with this?</p>