-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Empty show more show less
-
Not Needed
What problem are you facing?
Cannot use a code like this:
```typescript
db
.collection(snapshot)
.aggregate([])
.out("mycol")
.toArray()
.then(() => {});
```
Note steps for the pipeline are not included because they are not relevant for the issue.
What driver and relevant dependency versions are you using?
```
node: v14.17.5 LTS
npm: 7.21.0
node-mongodb: 4.1.0
```
Steps to reproduce?
```
cd /tmp/
mkdir test
cd test
npm init -y
npm i mongodb
mkdir src/
echo 'import
npx tsc src/index.ts
```
This is the output:
```
src/index.ts:1:83 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
1 import { Db }
from "mongodb"; let db: Db; db.collection("coll").aggregate([]).out("mycollection").toArray().then(() => {});
```
This is the related line of code: https://github.com/mongodb/node-mongodb-native/blob/b67af3cd/src/cursor/aggregation_cursor.ts#L132
`out` should be either an string or an object:
https://docs.mongodb.com/manual/reference/operator/aggregation/out/