mongodump command:
mongodump --host myhost.com --port 12345 --username myUsername --password PSWRD --out /opt/somepath --db myDb --collection my_collection --query "{ content_type_id: { \$not: { \$eq: db.my_type.findOne({slug: 'form_submissions'} )._id } } }" --verbose
Results in:
assertion: 16619 code FailedToParse: FailedToParse: Bad characters in value:
offset:33 of:{ content_type_id: { $not: { $eq: db.my_type.findOne({slug: 'form_submissions'} )._id } } }
That's not a valid query.
--querymust be a JSON document. Your error is in thinking that mongodump is something programmatic like the mongo shell that can evaluate thefindOneand substitute the value into the query. This is not the case. You can find the_idfrom the result of thefindOneand put it in the mongodump--querymanually. Use extended JSON format for an ObjectId type, if that is the type of_id.