Im learning full stack and im following along on a tutorial when I used the .find() it shows alot more information then the tutorial does and it is really confusing me.
i'd like to have just the information that i sent to the db not all the extra information that it provides here
const courseSchema = new mongoose.Schema({
name: String,
author: String,
tags: [String],
date: { type: Date, default: Date.now },
isPublished: Boolean
})
//Create a model class for Course
const Course = mongoose.model('course', courseSchema);
async function createCourse() {
const course = new Course({
name: 'fangular course',
author: 'yello',
tags: ['angular', 'frontend'],
isPublished: true
})
const result = await course.save();
console.log(result);
}
async function getCourses() {
let courses = await Course.find();
console.log(courses);
}
and i get this i just want the data that i had sent to the db not all this extra
removing: undefined,
inserting: true,
version: undefined,
getters: {},
_id: 5cb60a9fb5f9bc0d742d4ec1,
populate: undefined,
populated: undefined,
wasPopulated: false,
scope: undefined,
activePaths:
StateMachine {
paths: {},
states: [Object],
stateNames: [Array],
forEach: [Function],
map: [Function] },
pathsToScopes: {},
ownerDocument: undefined,
fullPath: undefined,
emitter:
EventEmitter {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: 0 },
'$options': true },
isNew: false,
errors: undefined,
_doc:
{ tags:
[ 'angular',
'frontend',
toBSON: [Function: toBSON],
_atomics: {},
_parent: [Circular],
_cast: [Function: _cast],
_markModified: [Function: _markModified],
_registerAtomic: [Function: _registerAtomic],
'$__getAtomics': [Function: $__getAtomics],
hasAtomics: [Function: hasAtomics],
_mapCast: [Function: _mapCast],
push: [Function: push],
nonAtomicPush: [Function: nonAtomicPush],
'$pop': [Function: $pop],
pop: [Function: pop],
'$shift': [Function: $shift],
shift: [Function: shift],
pull: [Function: pull],
splice: [Function: splice],
unshift: [Function: unshift],
sort: [Function: sort],
addToSet: [Function: addToSet],
set: [Function: set],
toObject: [Function: toObject],
inspect: [Function: inspect],
indexOf: [Function: indexOf],
remove: [Function: pull],
_path: 'tags',
isMongooseArray: true,
validators: [],
_schema: [SchemaArray] ],
date: 2019-04-16T17:02:23.832Z,
_id: 5cb60a9fb5f9bc0d742d4ec1,
name: 'fangular course',
author: 'yello',
isPublished: true,
__v: 0 } }