await collection.findOne({id: item.id}, {files: {$slice: 3}});
can not slice files array, in node.js
but,
db.files.findOne({id: '15'}, {files: {$slice: 3}})
it is work in shell
why?
await collection.findOne({id: item.id}, {files: {$slice: 3}});
can not slice files array, in node.js
but,
db.files.findOne({id: '15'}, {files: {$slice: 3}})
it is work in shell
why?
Hello @zhang_zhang, Welcome to the MongoDB community,
More details would be helpful,