@@ -18,6 +18,7 @@ import {
1818
1919import { debug } from '#src/debug'
2020import { Log } from '@athenna/logger'
21+ import { ObjectId } from '#src/helpers/ObjectId'
2122import { Driver } from '#src/database/drivers/Driver'
2223import { ModelSchema } from '#src/models/schemas/ModelSchema'
2324import { Transaction } from '#src/database/transactions/Transaction'
@@ -28,7 +29,6 @@ import { WrongMethodException } from '#src/exceptions/WrongMethodException'
2829import { MONGO_OPERATIONS_DICTIONARY } from '#src/constants/MongoOperationsDictionary'
2930import { NotConnectedDatabaseException } from '#src/exceptions/NotConnectedDatabaseException'
3031import { NotImplementedMethodException } from '#src/exceptions/NotImplementedMethodException'
31- import { ObjectId } from '#src/helpers/ObjectId'
3232
3333export class MongoDriver extends Driver < Connection , Collection > {
3434 public primaryKey = '_id'
@@ -1214,7 +1214,7 @@ export class MongoDriver extends Driver<Connection, Collection> {
12141214 public whereIn ( column : string , values : any [ ] ) {
12151215 values = values . flatMap ( value => {
12161216 if ( ObjectId . isValidStringOrObject ( value ) ) {
1217- return [ value , new ObjectId ( value ) ]
1217+ return [ String ( value ) , new ObjectId ( value ) ]
12181218 }
12191219
12201220 return [ value ]
@@ -1231,7 +1231,7 @@ export class MongoDriver extends Driver<Connection, Collection> {
12311231 public whereNotIn ( column : string , values : any [ ] ) {
12321232 values = values . flatMap ( value => {
12331233 if ( ObjectId . isValidStringOrObject ( value ) ) {
1234- return [ value , new ObjectId ( value ) ]
1234+ return [ String ( value ) , new ObjectId ( value ) ]
12351235 }
12361236
12371237 return [ value ]
@@ -1362,7 +1362,7 @@ export class MongoDriver extends Driver<Connection, Collection> {
13621362 public orWhereIn ( column : string , values : any [ ] ) {
13631363 values = values . flatMap ( value => {
13641364 if ( ObjectId . isValidStringOrObject ( value ) ) {
1365- return [ value , new ObjectId ( value ) ]
1365+ return [ String ( value ) , new ObjectId ( value ) ]
13661366 }
13671367
13681368 return [ value ]
@@ -1379,7 +1379,7 @@ export class MongoDriver extends Driver<Connection, Collection> {
13791379 public orWhereNotIn ( column : string , values : any [ ] ) {
13801380 values = values . flatMap ( value => {
13811381 if ( ObjectId . isValidStringOrObject ( value ) ) {
1382- return [ value , new ObjectId ( value ) ]
1382+ return [ String ( value ) , new ObjectId ( value ) ]
13831383 }
13841384
13851385 return [ value ]
@@ -1548,7 +1548,7 @@ export class MongoDriver extends Driver<Connection, Collection> {
15481548 const objectId = condition [ key ]
15491549
15501550 condition . $or . push (
1551- { [ key ] : objectId } ,
1551+ { [ key ] : String ( objectId ) } ,
15521552 { [ key ] : new ObjectId ( objectId ) }
15531553 )
15541554
@@ -1579,7 +1579,7 @@ export class MongoDriver extends Driver<Connection, Collection> {
15791579 const objectId = condition [ key ]
15801580
15811581 condition . $or . push (
1582- { [ key ] : objectId } ,
1582+ { [ key ] : String ( objectId ) } ,
15831583 { [ key ] : new ObjectId ( objectId ) }
15841584 )
15851585
0 commit comments