mongodb#InsertOneWriteOpResult TypeScript Examples
The following examples show how to use
mongodb#InsertOneWriteOpResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.ts From integration-services with Apache License 2.0 | 6 votes |
static async insertDocument<T>(
collectionName: string,
data: any,
options?: CollectionInsertOneOptions
): Promise<InsertOneWriteOpResult<WithId<T>> | undefined> {
const ommitedData: any = _.omitBy(data, _.isUndefined);
const collection = MongoDbService.getCollection(collectionName);
return collection?.insertOne(ommitedData, options);
}
Example #2
Source File: Database.ts From discord-statuspage-v2 with MIT License | 5 votes |
async addWebhook (webhook: DatabaseWebhook): Promise<InsertOneWriteOpResult<DatabaseWebhook>> {
return await this.db.collection('webhooks').insertOne(webhook)
}