Skip to content

migrated from mongo 6 to 8 and a query keeps running  #1720

Open
@markitosgv

Description

@markitosgv

Bug Report

Environment

I have a cluster in mongo 6, testing I have migrated to mongo 8, with the 1.20 driver.

There is an aggregate query that when executed remains undefined, are the same indexes and all the same as the dataset of mongo 6.

However this query if I run it from a mongo client works fine, so I suspect that there is a problem with the driver or the php library.

Its something related to lookup query, because if I remove lookup it works ok. So maybe is something I'm missingn about new way to do lookup queries on mongo 8?

the query is this:

db.collection.aggregate([
  {
    $match: {
      "readers": { $ne: { $oid: "650825bcbf6db135710001fb" } },
      "company": { $oid: "6509cef01f97635bac0cc36c" },
      "deletedAt": null,
      "lastInboundMessageAt": { $ne: null }
    }
  },
  {
    $lookup: {
      from: "Users",
      localField: "users",
      foreignField: "_id",
      as: "users"
    }
  },
  {
    $match: {
      "users.owners": { $oid: "650825bcbf6db135710001fb" }
    }
  },
  {
    $count: "_totalCount"
  }
]);

env data:

php 8.3
libbson bundled version => 1.28.0
libmongoc bundled version => 1.28.0
libmongoc SSL => enabled
libmongoc SSL library => OpenSSL
libmongoc crypto => enabled
libmongoc crypto library => libcrypto
libmongoc crypto system profile => enabled
libmongoc SASL => enabled
libmongoc SRV => enabled
libmongoc compression => enabled
libmongoc compression snappy => enabled
libmongoc compression zlib => enabled
libmongoc compression zstd => enabled
libmongocrypt bundled version => 1.11.0
libmongocrypt crypto => enabled
libmongocrypt crypto library => libcrypto
mongodb.debug => no value => no value


   requires
composer-runtime-api ^2.0
ext-hash *
ext-json *
ext-mongodb ^1.20.0
php ^8.3
psr/log ^1.1.4|^2|^3
symfony/polyfill-php80 ^1.27
symfony/polyfill-php81 ^1.27

requires (dev)
doctrine/coding-standard ^12.0
rector/rector ^1.1
squizlabs/php_codesniffer ^3.7
symfony/phpunit-bridge ^5.2
vimeo/psalm ^5.13

thanks

pd. on mongodb 7 I'm having same issue

pd2. is working if I put an unwind before lookup for users field (is an array of user ids)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions