Cannot save() object to MongoDB

Tell us what’s happening:
I’m not able to save the URL object into mongodb. I did console.log() to print out the urlObject and its like this:

{ url: ‘’,
_id: 5ddf49fe56afb15c8c19dad4 }

Your code so far

'use strict';

var express = require('express');
var mongo = require('mongodb');
var mongoose = require('mongoose');
var path = require('path');
var cors = require('cors');
var app = express();

// Basic Configuration 
var port = process.env.PORT || 3000;
var dns = require('dns')
var bodyParser = require('body-parser')

var request = require('request')
let URLModel = require('./urlModel')
/** this project needs a db !! **/ 
// mongoose.connect(process.env.MONGOLAB_URI);
mongoose.Promise = global.Promise


/** this project needs to parse POST bodies **/
// you should mount the body-parser here
app.use('/public', express.static(process.cwd() + '/public'));

app.get('/', function(req, res){
  res.sendFile(process.cwd() + '/views/index.html');

// your first API endpoint... 
app.get("/api/hello", function (req, res) {
  res.json({greeting: 'hello API'});
  let urlString = req.body.url
  request({method: 'HEAD', uri:urlString}, function (error, response, body) {
    if (!error && response.statusCode == 200) {
      let url = new URLModel({
      }) ,results)=> {
        res.json({'url': urlString, 'short_url': results})
      res.json({"error":"invalid URL"})

app.listen(port, function () {
  console.log('Node.js listening ...');

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0.

URLShortener API Microservices

Link to the challenge:

Link to my project code

do you have a link for your project?

what do you get if you console.log the err for save?

I’m wondering about the ./urlModel file and using an object for the parameter

let url = new URLModel({

here is the code of my project

console.log() inside the callback of save() doesn’t print anything even ‘err’ or ‘results’. I think it had trouble when executing the save(). I checked the connection String and whitelist all IP in my Atlas cluster…