DEV Community

Cover image for Which is better in MongoDB
Ifeanyi Chima
Ifeanyi Chima

Posted on • Edited on

1 1

Which is better in MongoDB

Which is better in MongoDB to use when saving documents ?

Image description

Save


const data = { "name": "Jerry", "password": "#343@" };

const newUser = new User(data);

const result = await newUser.save()

Enter fullscreen mode Exit fullscreen mode

Create


const result = await User.create({
  "name": "Jerry", "password": "#343@"
})

Enter fullscreen mode Exit fullscreen mode

Buy Me A Coffee

Thank you, please follow me

HTML GitHub

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up