3

I'm in the mongo shell and I have to remove documents that satisfies all of these conditions together:

status: 'CO'
renewPlan: true
paymentType: 'credit_card'
gatewayPayment: 'ebanx'

Ive tried this but didnt work:

db.transactions.deleteMany({ status : "CO" } $and {renewPlan: true } $and {paymentType: 'credit_card'} $and {gatewayPayment: 'ebanx'})
Fernanda
  • 59
  • 6

1 Answers1

0

MongoDB will implicitly and the conditions if you specify them all in one filter document. So you can do:

db.transactions.deleteMany({
  status: "CO",
  renewPlan: true ,
  paymentType: 'credit_card',
  gatewayPayment: 'ebanx'
})
Montgomery Watts
  • 3,806
  • 2
  • 10
  • 24