const mongoose = require('mongoose'); mongoose.connect('mongodb://localhost:27017/myapp', { useNewUrlParser: true, useUnifiedTopology: true }); const userSchema = new mongoose.Schema({ name: String, age: Number }); const User = mongoose.model('User', userSchema); const user = new User({ name: 'علی', age: 25 }); user.save().then(() => console.log('کاربر ذخیره شد'));