MongoDb introduced free text search beta in its v2.4 but it was in experimental phase. In v.2.6, MongoDb has finally made its free text search (the most requested feature) production ready. In this post, we will have a look at how can we use this pretty useful feature that MongoDb offers us. To enable Free text search, Mongodb...
We at IntelliGrape are an enthusiastic lot when it comes to technology conferences and knowledge sharing sessions. So lot of us were pretty excited to hear the news about mongoDB organising conferences in Delhi and Bangalore. More so, because we are early adaptors of MongoDB. Our entire Node.JS service line uses MongoDB as preferred...
Let us take a very common use-case: "There will be a registration page for users, where users will provide their required details along with their picture”. Details would be saved to MongoDB while the pictures would be uploaded to Cloudinary or S3 with user unique id." Suppose we have User Schema as given below: [js] /* * Schema...
Mongoose is a Node.js package that gives you an interface to play with mongo database. Mongoose has all sets of methods that help you to connect and access data stored in database. It translates data from database in javaScript object which you can provide to your application. We will move step by step to know how it works. 1....
In one of our Node.js projects, we used Mongoose module to interact with MongoDB. Mongoose provides us four types of built-in validation on schema as below: 1. Required: We can mark a field as required, which must be provided. 2. Limit: If field is type of Number in Schema, then we can restrict maximum and minimum value for that...
We can create collections in mongoDb on which we can apply size limit. These special type of collections are called Capped Collections. These are a kind of circular queues, in which if allocated size limit is reached, it makes space for new documents by overwriting the oldest documents in the collection. How to create Capped...
MongoDB provides a rich set of aggregation. $group is one of them, with the help of $group, we can group documents (similar as group By in SQL). Lets understand by an example: Suppose we have following collection of blogs: [js] { userId:1, name:"Suroor", title:"AngularJS: Getting started with Directive", rating:3} { userId:2,...
MongoDB provides several ways of computing the average value of a group in a collection. One of the simplest ways of determining average is using the method db.collection.group(). The method db.collection.group() bunches the documents of a collection on the basis of the keys mentioned and executes aggregation functions on them. This...
In my previous post, I explained how to get started with node.js and executing your first script with node. Now in this tutorial, we will go a step ahead and learn using Expressjs and MongoDB. For people who are new, Express is a web application framework for node which provides a set of features that can be used to build single-page as...
In this post, we will learn how to use javascript as MongoDB shell script to export (fields of) a collection. If you just want to execute MongoDB commands then look at the another post there.. OK, so let's focus back to the objective of this post. Generally, to export data from a MongoDB collection, we use the...
MongoDB uses javascript interface for the shell commands. We can really use this feature in a great way - by writing the MongoDB (shell) commands in a javascript (.js file) and execute in single go. In this blog, I am going to show an example for the same: [javascript] print('===== My Demo Script ====='); ...