काम नहीं करता मैं करने के लिए उन कोड चलाने की कोशिश की है को बचाने के लिए एक वस्तुMongoDB में।नेवला .save()
.save()
सफलतापूर्वक कभी नहीं चला। कोड ठीक चल रहा है।
.save()
विधि काम नहीं करता है।
var conn = mongoose.createConnection(mongoUrl, {auth: {authdb: "admin"}});
conn.on('error', function (err) {
throw err;
});
conn.once('open', function callback() {
console.log("connected to " + mongoUrl);
var cacheSchema = mongoose.Schema({}, {strict: false});
cacheSchema.set('collection', 'caches');
// you need to specify which connection is uing.
var Cache = conn.model('cache', cacheSchema);
var measure = new Cache();
measure['test'] = "test";
measure.save(function(err){
console.log('test');
});
});
'.save() कभी सफलता नहीं मिली 'आप कैसे बता सकते हैं? आपने इसे कॉलबैक नहीं दिया। –
क्या गलत है? त्रुटि पोस्ट करें –
मैंने कॉलबैक संपादित किया। मैंने ब्रेक पॉइंट को console.log() पर रखा है। यह कभी भी – sh977218