Using express and a mongoose model:
```
var mongoose = require('mongoose');
var app = express();
mongoose.connect('mongodb://huguesmongotask:14nzdLIn319hRM4gISqD4iQUSO9bKY.eK4nLHzyIFxY-@ds045107.mongolab.com:45107/huguesmongotask');
var Schema = mongoose.Schema;
var ObjectId = Schema.ObjectId;
var Task = new Schema({
task: { type: String, required: true }
});
var Task = mongoose.model('Task', Task);
```
and put a breakpoint in the inner callback:
```
app.get('/tasks/:id/edit', function(req, res){
Task.findById(req.params.id, function (err, doc){
res.render('tasks/edit', {
title: 'Edit Task',
task: doc
});
});
});
```
You should be able to see 'task' member for 'doc', but you don't. You'll see 'task' if you expand 'doc._doc'. In immediate window, these all work:
```
doc.task
doc._doc.task
doc['task']
doc['_doc']['task']
```
My project is on internal share here:
"\\ptvsroll\Backup\nodejs\todo.zip"

```
var mongoose = require('mongoose');
var app = express();
mongoose.connect('mongodb://huguesmongotask:14nzdLIn319hRM4gISqD4iQUSO9bKY.eK4nLHzyIFxY-@ds045107.mongolab.com:45107/huguesmongotask');
var Schema = mongoose.Schema;
var ObjectId = Schema.ObjectId;
var Task = new Schema({
task: { type: String, required: true }
});
var Task = mongoose.model('Task', Task);
```
and put a breakpoint in the inner callback:
```
app.get('/tasks/:id/edit', function(req, res){
Task.findById(req.params.id, function (err, doc){
res.render('tasks/edit', {
title: 'Edit Task',
task: doc
});
});
});
```
You should be able to see 'task' member for 'doc', but you don't. You'll see 'task' if you expand 'doc._doc'. In immediate window, these all work:
```
doc.task
doc._doc.task
doc['task']
doc['_doc']['task']
```
My project is on internal share here:
"\\ptvsroll\Backup\nodejs\todo.zip"
