" javascript "

How to use placeholder with Select2 and WordPress with wp_dropdown_categories

Recently while working on a site I had an issue with getting a placeholder to show up while using WordPress built in wp_dropdown_categories and Select2. The fix was pretty easy with a little bit of jQuery, which you can see below: (more…)

How to count the number of values found for a field in MongoDB using Node.js and Mongoose (using aggregation)

This post is part 1 of a series of posts I will make regarding Node.js and MongoDB.  I will be using the Mongoose module for Node.js, but for the most part the MongoDB syntax is about the same.  The ultimate goal with this series is to take data from a MongoDB database, and use that data to create a dynamic graph/chart with Morris.js.

The first step to this process is learning about MongoDB aggregation. The data we will be using in this example is a collection of products, that has a field product_manufacturer.  We will use MongoDB to return to us, the total number of products that each manufacturer has in our database.  So let’s get started .. (more…)