@@ -18,6 +18,7 @@ import {
18
18
19
19
import { debug } from '#src/debug'
20
20
import { Log } from '@athenna/logger'
21
+ import { ObjectId } from '#src/helpers/ObjectId'
21
22
import { Driver } from '#src/database/drivers/Driver'
22
23
import { ModelSchema } from '#src/models/schemas/ModelSchema'
23
24
import { Transaction } from '#src/database/transactions/Transaction'
@@ -28,7 +29,6 @@ import { WrongMethodException } from '#src/exceptions/WrongMethodException'
28
29
import { MONGO_OPERATIONS_DICTIONARY } from '#src/constants/MongoOperationsDictionary'
29
30
import { NotConnectedDatabaseException } from '#src/exceptions/NotConnectedDatabaseException'
30
31
import { NotImplementedMethodException } from '#src/exceptions/NotImplementedMethodException'
31
- import { ObjectId } from '#src/helpers/ObjectId'
32
32
33
33
export class MongoDriver extends Driver < Connection , Collection > {
34
34
public primaryKey = '_id'
@@ -1214,7 +1214,7 @@ export class MongoDriver extends Driver<Connection, Collection> {
1214
1214
public whereIn ( column : string , values : any [ ] ) {
1215
1215
values = values . flatMap ( value => {
1216
1216
if ( ObjectId . isValidStringOrObject ( value ) ) {
1217
- return [ value , new ObjectId ( value ) ]
1217
+ return [ String ( value ) , new ObjectId ( value ) ]
1218
1218
}
1219
1219
1220
1220
return [ value ]
@@ -1231,7 +1231,7 @@ export class MongoDriver extends Driver<Connection, Collection> {
1231
1231
public whereNotIn ( column : string , values : any [ ] ) {
1232
1232
values = values . flatMap ( value => {
1233
1233
if ( ObjectId . isValidStringOrObject ( value ) ) {
1234
- return [ value , new ObjectId ( value ) ]
1234
+ return [ String ( value ) , new ObjectId ( value ) ]
1235
1235
}
1236
1236
1237
1237
return [ value ]
@@ -1362,7 +1362,7 @@ export class MongoDriver extends Driver<Connection, Collection> {
1362
1362
public orWhereIn ( column : string , values : any [ ] ) {
1363
1363
values = values . flatMap ( value => {
1364
1364
if ( ObjectId . isValidStringOrObject ( value ) ) {
1365
- return [ value , new ObjectId ( value ) ]
1365
+ return [ String ( value ) , new ObjectId ( value ) ]
1366
1366
}
1367
1367
1368
1368
return [ value ]
@@ -1379,7 +1379,7 @@ export class MongoDriver extends Driver<Connection, Collection> {
1379
1379
public orWhereNotIn ( column : string , values : any [ ] ) {
1380
1380
values = values . flatMap ( value => {
1381
1381
if ( ObjectId . isValidStringOrObject ( value ) ) {
1382
- return [ value , new ObjectId ( value ) ]
1382
+ return [ String ( value ) , new ObjectId ( value ) ]
1383
1383
}
1384
1384
1385
1385
return [ value ]
@@ -1548,7 +1548,7 @@ export class MongoDriver extends Driver<Connection, Collection> {
1548
1548
const objectId = condition [ key ]
1549
1549
1550
1550
condition . $or . push (
1551
- { [ key ] : objectId } ,
1551
+ { [ key ] : String ( objectId ) } ,
1552
1552
{ [ key ] : new ObjectId ( objectId ) }
1553
1553
)
1554
1554
@@ -1579,7 +1579,7 @@ export class MongoDriver extends Driver<Connection, Collection> {
1579
1579
const objectId = condition [ key ]
1580
1580
1581
1581
condition . $or . push (
1582
- { [ key ] : objectId } ,
1582
+ { [ key ] : String ( objectId ) } ,
1583
1583
{ [ key ] : new ObjectId ( objectId ) }
1584
1584
)
1585
1585
0 commit comments