선생님, objectid 타입 관련 궁금한 점이 있습니다. 프론트 엔드쪽에서 input type text 형태로 value 값을 받아와 OID type의 field에 집어넣으려고 하는데, 구글링으로 이래저래 해봤는데 안되더라구요.
attachment=File.createNewInstance(req.file, req.user._id)
var mongoose = require('mongoose');
attachment.oid=mongoose.Types.ObjectId(req.body.oid);
attachment.save()
위에방식으로 해봤는데 안되더라구요..attachment instance 의 oid field는 ObjectId type 이고, 프론트 엔드쪽에서 id랑 name 이 oid 인 input type text 의 value 값을 건네받아 db에 objectid형태로 저장하려합니다.
혹시 팁이 있다면 알려주심 감사하겠습니다!!