0
......
......

@Prop({
    type: [
      {
        line_item_uid: { type: String },
        product_ref_id: {
          type: mongoose.Schema.Types.ObjectId,
          ref: "Product",
          select:false
        },
        image: String,
        name: String,    
        purchase_price: Number,
        serial_nos: [],
        total: Number,      
        approval_status: {
          type: String,
          enum: ["PENDING", "APPROVED", "REJECTED"],
        }, 
      },
    ],
  })
  line_items: mongoose.Mixed;

.....
.....

it is a schema for invoices. On getting the details of this invoice I need to exclude product_ref_id from line_items array. what should I do? i am using nestjs,mongoose and also using select option to pick other fields..

GET_INVOICES_DETAILS = "-_id invoice_uid invoice_no total invoice_status invoice_date due_date job financing is_paid created_at updated_at line_items estimate customer_billing_address customer_service_address sub_total discount total_discount remarks tax attachments public_url reference_no --product_ref_id", these are fields I need to pick

1 Answers1

0

You can try this:

Entity.find({ ... }, '--product_ref_id', function(err, entity) {
    console.log(entity); 
});
3gwebtrain
  • 14,640
  • 25
  • 121
  • 247