Hello,
I was wondering if it is possible through Mongosh to the values in a cursor as values in a query qualifier like so:
var myCursor = db.foo.find({field1:‘abc’}, {field2:1});
while (myCursor.hasNext()) { db.foo.updateOne({field2: myCursor.next() }, { $set :{field1: ‘xyz’}})
I tried the following but they all give syntax errors on "field2:myCursor.next():
var myCursor = db.foo.find({field1:‘abc’}, {field2:1});
while (myCursor.hasNext()) { db.foo.updateOne({field2: myCursor.next() }, { $set :{field1: ‘xyz’}})
and
var myCursor = db.foo.find({field1:‘abc’}, {field2:1});
while (myCursor.hasNext()) { db.foo.updateOne(myCursor.next(), { $set :{field1: ‘xyz’}})
I want Mongosh to recognize that myCursos.next() = field2:.
Thanks
John