Unable to add collumn in mongo

Posted on

Question :

Something strange in this neighbourhood. Calling DBA’s and ! GB

db.getCollection('contacts').update({}, {$set: {"source": "domain.txt"}},false,true);

It failed with:

admin> db.getCollection('contacts').update({}, {$set: {"source": "domain.txt"}},false,true);
[2020-09-29 23:24:32] java.lang.IllegalArgumentException: options should be an object: false
[2020-09-29 23:24:32] options should be an object: false

Also, table feels a little corrupted. No longer displays the amount of records.

Based on answers from https://stackoverflow.com/questions/7714216/add-new-field-to-every-document-in-a-mongodb-collection

Answer :

Turns out mongo cli client needs to be on version 4.4
I had version 3

Leave a Reply

Your email address will not be published. Required fields are marked *