Friday 8 June 2018

Please help! Really frustrated with koa-mongo

Lmk if this is the wrong sub for this, but I'm trying to get a super simple task going using koa-mongo and I can't figure it out.I'm sending a simple json object to my koa server, like {foo: 'bar'}, and I want to be able to perform CRUD operations in the DB using the module.The example in the github page is nonsensical to me; for example it has the line const result = await ctx.mongo.db('test').collection('users').insert({ name: 'haha' }); but ctx.mongo does not even have a "db" property that my IDE recognizes and I can't find it in the source code. Can someone please break down how the Example code from the github page works?How do you simple store a json k:v in the DB and then pull it?Thanks so much.

Submitted June 08, 2018 at 01:17PM by animanicats

No comments:

Post a Comment