|
1 | 1 | import { expect } from 'chai';
|
2 | 2 |
|
3 |
| -import { type CommandStartedEvent, MongoServerError, ObjectId } from '../../mongodb'; |
| 3 | +import { type Collection, type CommandStartedEvent, type Db, MongoServerError, ObjectId } from '../../mongodb'; |
4 | 4 | import { setupDatabase } from '../shared';
|
5 | 5 |
|
6 | 6 | describe('Collection (#findOneAnd...)', function () {
|
@@ -324,6 +324,31 @@ describe('Collection (#findOneAnd...)', function () {
|
324 | 324 | });
|
325 | 325 | });
|
326 | 326 | });
|
| 327 | + |
| 328 | + describe('update filter', function () { |
| 329 | + context('when $currentDate is provided', function () { |
| 330 | + let client; |
| 331 | + let db: Db; |
| 332 | + let collection: Collection; |
| 333 | + |
| 334 | + beforeEach(async function () { |
| 335 | + client = this.configuration.newClient({ w: 1 }); |
| 336 | + await client.connect(); |
| 337 | + db = client.db(this.configuration.db); |
| 338 | + collection = db.collection('test_coll'); |
| 339 | + await collection.insertOne({ a: 'c' }); |
| 340 | + }); |
| 341 | + |
| 342 | + afterEach(async function () { |
| 343 | + await collection.drop(); |
| 344 | + await client.close(); |
| 345 | + }); |
| 346 | + |
| 347 | + it(`should support fields with value 'true'`, async function () { |
| 348 | + await collection.findOneAndUpdate({}, { $set: { a: 1 }, $currentDate: { lastModified: true } }, { writeConcern: { w: 1 } }); |
| 349 | + }); |
| 350 | + }); |
| 351 | + }); |
327 | 352 | });
|
328 | 353 |
|
329 | 354 | describe('#findOneAndReplace', function () {
|
|
0 commit comments