Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-57561

db.view.find() breaks with --apiStrict

    • Fully Compatible
    • ALL
    • v5.0
    • Hide
      • Spin up a 5.0.0-rc0 server
      • Connect with mongosh or mongo and run the steps below:
      MongoDB Enterprise replset:PRIMARY> use testdb
      switched to db testdb
      MongoDB Enterprise replset:PRIMARY> db.source.insertOne({})
      {
      	"acknowledged" : true,
      	"insertedId" : ObjectId("60c088057ddf468ccc60c5e6")
      }
      MongoDB Enterprise replset:PRIMARY> db.createView('view', 'source', [{$match: {}}])
      {
      	"ok" : 1,
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1623230493, 2),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	},
      	"operationTime" : Timestamp(1623230493, 2)
      }
      MongoDB Enterprise replset:PRIMARY> db.view.find()
      Error: error: {
      	"ok" : 0,
      	"errmsg" : "BSON field 'aggregate.runtimeConstants' is not allowed with apiStrict:true.",
      	"code" : 323,
      	"codeName" : "APIStrictError",
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1623230493, 2),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	},
      	"operationTime" : Timestamp(1623230493, 2)
      }
      

      As you can see, the view is trivial and its aggregation not require any unversioned APIs.

      Show
      Spin up a 5.0.0-rc0 server Connect with mongosh or mongo and run the steps below: MongoDB Enterprise replset:PRIMARY> use testdb switched to db testdb MongoDB Enterprise replset:PRIMARY> db.source.insertOne({}) { "acknowledged" : true , "insertedId" : ObjectId( "60c088057ddf468ccc60c5e6" ) } MongoDB Enterprise replset:PRIMARY> db.createView( 'view' , 'source' , [{$match: {}}]) { "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1623230493, 2), "signature" : { "hash" : BinData(0, "AAAAAAAAAAAAAAAAAAAAAAAAAAA=" ), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1623230493, 2) } MongoDB Enterprise replset:PRIMARY> db.view.find() Error: error: { "ok" : 0, "errmsg" : "BSON field 'aggregate.runtimeConstants' is not allowed with apiStrict: true ." , "code" : 323, "codeName" : "APIStrictError" , "$clusterTime" : { "clusterTime" : Timestamp(1623230493, 2), "signature" : { "hash" : BinData(0, "AAAAAAAAAAAAAAAAAAAAAAAAAAA=" ), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1623230493, 2) } As you can see, the view is trivial and its aggregation not require any unversioned APIs.
    • Query Optimization 2021-06-28

      A view cannot be accessed with .find() when the connection uses --apiStrict.

      Trying do to so results in BSON field 'aggregate.runtimeConstants' is not allowed with apiStrict:true.

            Assignee:
            ruoxin.xu@mongodb.com Ruoxin Xu
            Reporter:
            anna.henningsen@mongodb.com Anna Henningsen
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: