mongodb

A 4-post collection

GitYeller.com is my latest weekend project

It all started when Adonis told me that he was looking to contribute to some open source projects. He had a list of projects that he actively uses but he didn't want to always be checking their issues list for new issues that he could get his hands on. So we thought it would be cool if we had a way to watch a GitHub repository for issues of specific tags, e.g. "Need help", "Good first contribution", etc. I »

MongoDB Aggregation: $lookup for JOINs

As of MongoDB 3.2, a new feature has been added that introduces a left outer join for the first time. $lookup is part of the MongoDB aggregation pipeline. It's a separate stage and the syntax is really simple: db.orders.aggregate([ { $lookup: { from: "inventory", localField: "item", foreignField: "sku", as: "inventory_docs" } } ]) The above command will fetch every document from the orders collection with the inventory_docs field in each one of them, populated with the matched documents from the »

Mongoose objects and the IN operator

Today I lost a few hours trying to understand why a document that I was fetching through Mongoose, kept returning true against checking for a field with the in operator, even though the document didn't contain that field. But still it would return true: var mongoose = require('mongoose'), Schema = mongoose.Schema; var exampleSchema = new Schema({ someField: String, notExistingField: String }, { versionKey: false }); /* We know that this document doesn't have the notExistingField in the DB */ exampleSchema.findOne({ '_id': id }) .exec(function( »

Geospatial Query with MongoDB and Node.js

Hasn't been a long time when i started working with Wearetech.io and my first challenge was on. Sweet! If you want to learn more about Wearetech.io, check the site and our Github repo. Now on the fun part. We have a use case where an individual would be able to register on our site as a City Curator. He could search for his City and if he wouldn’t find it in our database he would register it. »