$slice does not work in findOne method in node.js driver

await collection.findOne({id: item.id}, {files: {$slice: 3}});

can not slice files array, in node.js

db.files.findOne({id: '15'}, {files: {$slice: 3}})

it is work in shell

Hello @zhang_zhang, Welcome to the MongoDB community,

More details would be helpful,

  • What error are you getting
  • What is the version of mongodb driver?
  • Share a example document and expected result