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