Hi @nraboy, attended your Developer workshop at Connect2017 and really enjoyed it, thanks for all that you and your team do.
I recently came across Ottoman and have been following your tutorial at the following link Developing an API with Node.js using Couchbase NoSQL and Ottoman . Great material, but I found a quirk and hopefully I’m missing something simple.
Here’s a sample of a snippet of the api written in this tutorial:
router.get("/:id", function(req, res) {
PersonModel.getById(req.params.id, {load: ['comments']}, function(error, person) {
if(error) {
return res.status(400).send(error);
}
console.log(person);
res.send(person);
});
});
So my issue is that when I get a person’s info from their ID, I’m not getting all the details from the referenced document (comment). Here’s sample output that I get:
{
"$ref": "Comment",
"$id": "5b7b09e8-0bd3-4cc8-a476-d91d5bc3a59d"
}
I should be getting the detailed information from the reference document, and as you can see I am loading the comments as i should be. Even weirder is that I console logged the object (only a snippet shown below) before I res.send it and it shows that the comment details are loaded.
comments: [ OttomanModel(`Comment`, loaded, key:Comment|5b7b09e8-0bd3-4cc8-a476-d91d5bc3a59d, {
timestamp: 2017-11-18T07:39:37.820Z,
_id: '5b7b09e8-0bd3-4cc8-a476-d91d5bc3a59d',
message: 'This message is a test',
})]
So I’m not sure why the actual returned object does not contain the detailed message. I am using ottoman version 1.0.4 and couchbase version 2.4.2.
Thank you