Mongo::Error::OperationFailure: BSON field 'delete.deletes.q' is missing but a required field

346 Views Asked by At

I'm upgrading a rails app thats using MongoDB starting at Rails 4.2 and MongoDB 3.4

Ruby version is 2.7.6 MongoDB is 3.7 Rails 5.2

I've updated the app from database_cleaner to database_cleaner-mongoid. In my spec/rails_helper.rb I call DatabaseCleaner.clean before every example.

I get this Error:

Failures:

  1) Testy McTesterson
     Failure/Error: DatabaseCleaner.clean

     Mongo::Error::OperationFailure:
       [40414:Location40414]: BSON field 'delete.deletes.q' is missing but a required field (on localhost:27017, retries disabled)
     # ./spec/rails_helper.rb:125:in `clean_db'
     # ./spec/rails_helper.rb:112:in `block (2 levels) in <top (required)>'
     # ./spec/support/webmock.rb:27:in `block (2 levels) in <top (required)>'

To be clear, I'm always getting this error. I moved to database_cleaner-mongoid hoping it would resolve it. I've tried 3.6-4.4 versions of MongoDB. I also used the debugger to step through the code to find that error and I lose the context when it enters the kernel. Hoping someone has suggestions on where to look or if they've experienced it before.

1

There are 1 best solutions below

0
Travis On

This is resolved with Ruby 2.7.6 Mongoid 6.1.1 Rails 5.07.2 MongoDB 4.4