Why does opening this API/test page log the whole documents inside Users
collection instead of only names?
import { connectToDatabase } from "../../utils/mongodb"
export default async (req, res) => {
const { db } = await connectToDatabase();
try{
const userNames = await db.collection('Users').find({}, {name: 1, _id: 0}).toArray()
console.log('userNames '+JSON.stringify(userNames))
}catch(err){
console.log(err)
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…