Minimal repro:
db.coll.drop(); db.coll.insert([{_id: 1}, {_id: 2}]); const results = db.coll.aggregate([{$setWindowFields: {sortBy: {"_id": 1}, output: {"a": {$shift: {output: "$b", by: 1, default: "c"}}}}}]).toArray(); jsTestLog(results);
Minimal repro:
db.coll.drop(); db.coll.insert([{_id: 1}, {_id: 2}]); const results = db.coll.aggregate([{$setWindowFields: {sortBy: {"_id": 1}, output: {"a": {$shift: {output: "$b", by: 1, default: "c"}}}}}]).toArray(); jsTestLog(results);