Check out example codes for "mangoosejs". It will help you in understanding the concepts better.

Code Example 1

const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/test', {useNewUrlParser: true, useUnifiedTopology: true});

const Cat = mongoose.model('Cat', { name: String });

const kitty = new Cat({ name: 'Zildjian' });
kitty.save().then(() => console.log('meow'));

Learn ReactJs, React Native from akashmittal.com