GraphQLGuide / apollo-datasource-mongodb

Apollo data source for MongoDB
MIT License
285 stars 64 forks source link

this.collections.insertOne's document argument is an entire schema #21

Closed jblevins1991 closed 4 years ago

jblevins1991 commented 4 years ago

Right now if you look at insertOne's documentation, the doc argument is the document to insert. In your index.d.ts file the doc argument is an entire schema. This does not align with the spec for insertOne.

insertOne from index.d.ts:

insertOne(docs: OptionalId<TSchema>, callback: MongoCallback<InsertOneWriteOpResult<WithId<TSchema>>>): void;
    insertOne(docs: OptionalId<TSchema>, options?: CollectionInsertOneOptions): Promise<InsertOneWriteOpResult<WithId<TSchema>>>;
    insertOne(docs: OptionalId<TSchema>, options: CollectionInsertOneOptions, callback: MongoCallback<InsertOneWriteOpResult<WithId<TSchema>>>): void;
9at8 commented 4 years ago

I believe you're looking at types coming from @types/mongodb

9at8 commented 4 years ago

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/mongodb/index.d.ts#L1114

jblevins1991 commented 4 years ago

You are correct. ✌️