diff --git a/index.ts b/index.ts index 2219381..577ee75 100644 --- a/index.ts +++ b/index.ts @@ -3113,7 +3113,7 @@ const $setDifference = at('$setDifference'); const $setEquals = pta('$setEquals'); // TODO -const $setField = (field: string, value: Expression, input: ObjectExpression) => ({ +const $setField = (input: ObjectExpression, field: string, value: Expression) => ({ $setField: { field, input, value }, }); diff --git a/pipeline.test.ts b/pipeline.test.ts index 3638cb2..0cb6f30 100644 --- a/pipeline.test.ts +++ b/pipeline.test.ts @@ -1571,7 +1571,7 @@ describe('aggregation', () => { expect($.setField).toStrictEqual($.$setField); }); it('returns expected result', () => { - expect($.setField('foo', '$value', '$doc')).toEqual({ + expect($.setField('$doc', 'foo', '$value')).toEqual({ $setField: { field: 'foo', value: '$value',