Skip to Main Content

ORDS, SODA & JSON in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Different result than MongoDB with projection of dotted path to top level

Franck Pachot6 days ago — edited 2 days ago

The following query yields a different result in MongoDB and its Oracle emulation (tested on 23.9.0.25.08).

I have the following document:

[
 {
   customer_id: "C003",
   contact: [
     {
       email: [
         "narrator@fightclub.com",
         "tyler.durden@fightclub.com"
       ]
     },
     {
       phone: "555-2390"
     }
   ]
 }
]

The following query returns no document in MongoDB, but returns a document in Oracle Database

db.collection.aggregate([
 {
   $project: {
     customer_id: 1,
     email: "$contact.email"
   }
 }
])

It should not return a document because the projection should result to an array of arrays like this:

"email": [ [ "narrator@fightclub.com", "tyler.durden@fightclub.com" ] ]

However, in Oracle, the same projection results in:

email: [ 'narrator@fightclub.com', 'tyler.durden@fightclub.com' ]

Full test case: https://mongoplayground.net/p/hsc5irQJESB (also here for full explanation)

Comments
Post Details
Added 6 days ago
0 comments
69 views