Reference fields not updating

Getting the following error while updating an array of objects with $ref field.
The DBRef $ref field must be followed by a $id field

Using the following query:

shopCollection.updateOne({_id:ObjectId("601c12ae89e49906305488b5")},
  {$push:{products:{$ref: "products",$id: ObjectId("601c0a532da6b110a06d4b0a")}}},function(err,result){
    if(err){
      console.log(err);
    }
  })

products array validation schema:

products:{
            bsonType:"array",
            items:{
                bsonType:"object",
                properties:{
                    $ref:{
                        bsonType:"products",
                        description: "required"
                    },
                    $id:ObjectId
               }
            }
        }

Hi @Gurneet_Singh,

Welcome to MongoDB community.

Not sure what driver you are using but not certain that what you are performing is valid outside of the shell.

In mongoose I see a different syntax:
https://mongoosejs.com/docs/guide.html#selectPopulatedPaths

In node js as well:
http://mongodb.github.io/node-mongodb-native/3.6/api/DBRef.html

Thanks,
Pavel