MongoDB (from humongous) is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. MongoDB is developed by MongoDB Inc. and is free and open-source, published under a combination of the GNU Affero General Public License and the Apache License.

Share tech news, updates, or what's on your mind.

Sign up to Post

Mongo vs. Postgres DB.  Can you anyone pointed pros and cons?  And from the personal experience advice?
Live webcast with Pinal Dave
Live webcast with Pinal Dave

Pinal Dave will teach you tricks to help identify the real root cause of database problems rather than red herrings. Attendees will learn scripts that they can use in their environment to immediately figure out their performance Blame Shifters and fix them quickly.

Hello. I am working on a node application.  I'm trying to use Passport for the log in.   I found an example online of what I want to do.  However I cannot get it to work.  I am running into an issue with my routes.  I get a compiler error that I have not seen before.  I tried to attached the project to this question, but it won't accept zip files so I will just attach my index.js and AuthController.js.  This is the error I get on index.js when it tries to do my first route.
var auth = require("../controllers/AuthController.js");

// restrict index for logged in user only
router.get('/', auth.home);

Open in new window

I get this error:  
throw new mongoose.Error.OverwriteModelError(name);
OverwriteModelError: Cannot overwrite `User` model once compiled.
at MongooseError.OverwriteModelError (C:\Users\ernest\Documents\coding bootcamp\code\Passport MongoDB\node-passport-auth\node_modules\mongoose\lib\error\overwriteModel.js:18:11)
    at Mongoose.model (C:\Users\ernest\Documents\coding bootcamp\code\Passport MongoDB\node-passport-auth\node_modules\mongoose\lib\index.js:349:13)
    at Object.<anonymous> (C:\Users\ernest\Documents\coding bootcamp\code\Passport MongoDB\node-passport-auth\models\user.js:12:27)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require …
I am about to start to play around with the Bitcoin open source, source code, and got introduced to a new term: a Blockchain database.

What technologies are needed for this? Is this NO-SQL?

Hello All,

I am reading a book called express.js Blueprints.  I am trying to wrap my mind around understanding authentication using passport.  serializing and deserializing is not registering to me.  I have just started learning node and express js so that's a big reason why.

Here's a code from the book on setting up passport.  Starting with line 5, can someone please break down what's happening?  Where is the "user" parameter coming from in the serializeUser function?  Where did "" come from?

var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var User = require('mongoose').model('User');

passport.serializeUser(function(user, done) {
passport.deserializeUser(function(id, done) {
User.findById(id, done);

passport.use(new LocalStrategy(function(email, password, done) {
email: email
}, function(err, user) {
if (err) return done(err);
if (!user) {
return authFail(done);
if (!user.validPassword(password)) {
return authFail(done);
return done(null, user);

Open in new window

I am trying to connect to MongoDB in mongoDBatlas from my javascript but I keep getting the following error.

MongoError: connection 5 to closed
    at Function.MongoError.create (C:\Users\558642\ga\js-dc-5\11-crud-and-dbs\assignment\todo\node_modules\mongodb-core\lib\error.js:29:11)
    at TLSSocket.<anonymous> (C:\Users\558642\ga\js-dc-5\11-crud-and-dbs\assignment\todo\node_modules\mongodb-core\lib\connection\connection.js:202:22)
    at Object.onceWrapper (events.js:293:19)
    at emitOne (events.js:101:20)
    at TLSSocket.emit (events.js:191:7)
    at _handle.close (net.js:511:12)
    at Socket.done (_tls_wrap.js:332:7)
    at Object.onceWrapper (events.js:293:19)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at TCP._handle.close [as _onclose] (net.js:511:12)

Here's my code
const express = require('express')
const hbs = require('express-handlebars')
const mongoose = require('mongoose')
const bodyParser = require('body-parser')


const itemEntry = require('./models/toDoEntry.js')
const app = express()

app.get('/', function( req, res ) {
	itemEntry.find({}, function( err, itemEntries ) {

Open in new window

Hi there,

I have a mongo aggregation query that works fine in the mongo shell (and robomongo) but I can not work out how to translate this into a PHP query.

I am using PHP 5.6 with the latest mongo class (MongoDB\Driver\Query).  The mongo query looks like this:

     {$match: {
             vendor_name : "vendor8",
             distributor_id : 8
     { $sort: { 
         cw_product_code: 1, download_Date: 1 
     { $group:
           _id: "$cw_product_id",
           lastDownloadDate: { $last: "$download_Date" },
     {allowDiskUse: true}     

Open in new window

Any help to point me in the right direction would be appreciated.
hi, i have the following document on mongodb

name: "john",
state: "GA",
city: [
     {"atlanta", 30350},
     {"atlanta", 30351},
     {"atlanta", 30352},
     {"marietta", 45093}

how do i aggregate the array of citys and get a document like this:

name: "john",
state: "GA",
city: [
     {"atlanta", "30350, 30351, 30352"},
     {"marietta", "45093"}
What is the equivalent package for oracle  dbms_application_info..set_module in postgreSQL
Hi Experts,

I have a database that did grow monthly the following in MB
What is the way to calculate the expected growth for the next few months?
I have 2 tables that look like this:

Table1: EntityID, FamilyID

Table 2: EntityID, ParentEntityID

Table 1 contains a list of entities with FamilyID column currently all NULLs. Table 2 provides family information between entities. E.g.: an entity can be linked to a parent entity, a grandparent entity, to grandparent, etc.. A single entity can be linked to multiple parent entities too (just like in Family2 in the example below)

I am looking for an SQL that generates and populates a unique family ID for all linked Entities in the Table1. Example, if Table2 has the following data:

Than Table1 FamilyID column should be populated as follows:
1, family1
2, family1
3, family2
4, family2
5, family2
6, family2

Note, Table2 currently has 3 million records. And table 1 has about 5.5 million not all entities have parents)...

Thank you, Experts!
Creating Active Directory Users from a Text File
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Hi Experts,

We have SQL Express 2005 and I realized our data file is almost reaching the limit (4GB).
Now my question is, how can I shrink the size of the file in order to prolong the need to upgrade (FE/BE)?

Also I see one table that has about 200 MB used for data and 450 MB for indexes, is that acceptable?
How can I see what indexes are not being used so frequent and can be dropped (for a particular table or in general)?

PS. Our front end app is an Access ADP and then therefore I don't see how the database can be split.

Thanks in advance.
Hi I have a colleague who has a SQL Script that she runs in Crystal Reports.  I need this similar script to run on our AIX box for a certain program.  It runs fine in Crystal, but it just hangs on our IBX AIX box.

It has like 14 SELECT Statements.  Is there a way I can step through this script in SQL, like a debug tool, so I can see why it is running a long time or failing without me knowing?  I wish there was a log file or something?  Is there??

Thanks in advance for help!
Lets say you have a table:
Name   City            Date
Bob      Anytown   2017-03-15
Bob      Anytown   2017-03-21
Jim       Sometown 2017-02-27
John    Mytown      2017-03-06
John    Mytown      2017-03-19
John    Mytown      2017-03-25

I need to query the table so that my results are as follows:
Name  City            Dates
Bob     Anytown    2017-03-15,2017-03-21
Jim      Sometown 2017-02-27
John    MyTown     2017-03-06,2017-03-19,2017-03-25

I guess I'm asking how can I (can I?) have the results of a single field query reported in a single row rather than multiple rows?


I know how I can use a programming language to manipulate this (VB/ASP for example), with looks, but I'm looking for a pure SQL way.  IDEALLY MySQL way.
we have located a sql script (*.sql) on a file share which seems to show passwords for an initial creation of a SQL database, for example it has sp_addlogin commands, and then a number of accounts and passwords.

However, the password does not seem to comprise of standard alpha numeric characters, and contains a number of "special" characters, e.g. µ, ·, â, Ë

can SQL Server handle these characters in a password, or is it more likely this is some sort of encrypted representation of the password? Or can you use any character you like in a SQL Server password? It seems a bizarre combination if you ever had to enter those when entering a password to access a database, I was just intrigued what it may be, and whether SQL Server can use those characters or if its restricted to more common values, e.g. a..z, A..Z, !"£$%^&*()-, 0..9 etc.
Dear experts,

I have a query that look like this:

SELECT GUIDCustomer, MAX(CreatedDate) AS 'latestTransDate'
FROM Invoice i
WHERE Completed = 1
AND Type = 'O'

The result will give me the latest date of each customer in Invoice table when invoices are completed.

I also wish to obtain the GUIDInvoice from the above query but unfortunately, I need to add GUIDInvoice in GROUP BY clause.
What I want to achieve is to find the latest transaction date by each customer and also obtain the GUIDInvoice of the invoice with latest transaction date. I wish to know how can I adjust my query to obtain that result. Thanks
Our sql server is a VM with vmware.  I know that the classical way to set up partitions for a sql server was to have 3 partitions.
1) for the os
2) for the mdf
3) for the ldf files

I have also heard that since vmware has came to prominence that this is not a big concern anymore.  meaning....  you can responsibly run a sql server install on 2 partitions now.
1) os
2) mdf and ldf

Can someone confirm that it is ok to run sql servers with either setup.  currently we are choosing the second way of setting up our sql servers, but i have a vendor that is highly recommending that we go to the classic 3 partition setup.

Thanks a bunch!
I have an AMS / eCommerce application that runs on IIS7 / WIN2008 R2 SP1. Databases for this application sit on two nodes of SQL Server 2008 that runs on Windows Failover Cluster. In the light of needing to fix "Sweet32" vulnerability, which is removing 3DES cipher and removing TLS1.0 protocols I had to update SQL Server 2008 environment to SP4 and apply TLS1.2 patch to it. I also updated .NET 4.5.2 with a security patch from Microsoft.

So, once I did this, I disabled DES/3DES ciphers and TLS 1.0 protocols on the web server and my application stopped working. I get
"site currently unavailable" message on the web browser.

When I look at the event viewer on the web server, I get series of error messages.

Event ID: 1309
Event Code: 3005
Process name: w3wp.exe

Exception Information:
Exception type: SqlException
Exception message: A communication was successfully established with the server, but then an error occured during the login process. (Provider: SSL Provider, error:0 - The client and server cannot communicate, because they do not possess a common algorithm)

Then there are a number of Schannel events:

Event ID 36871: A Fatal error occured while creating an SSL client credential. The internal error state is 10013.

Any thoughts appreciated.
Thank you,
What kind of factors do you need to consider in terms of defining offline backup retention (tape) for your major IT systems/data. Do you work towards any specific retention policy, e.g. 6 months oldest, or if you are keeping things for over 6 months - for what purposes? Our main systems are all driven by MSSQL databases, and some apps enforce retention policies for the online copy of the data - just wondered what kinds of things you factor in to determine how long you retain offline backups for (tape) as offsite storage for D/R is not all that cheap.
hi how can i write this code better

cursor get_emp_id is
    select id form emp_temp
	   where name = :block.itemName;
for curr3 in get_emp_id loop
		wrk_curr_emp :=  GEN_CURRENT_empaccNo(;
		if wrk_curr_nsn != then
			message('this is not current accno');
			raise form_trigger_failure;
			:block.idNr :=
		elsif wrk_curr_nsn !=  then
				:block.idnr := 	wrk_curr_emp;
			end if;
		--	end if;
		end loop;

Open in new window

A proven path to a career in data science
A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Hi All,

I have a product master with schema like this :

1. ItemCode
2. Name
3 Unit
4, Unit1
5. Ratio1
6. Unit2
7. Ratio2

Example : Coca Cola, BTL, DZN 12, CTN 50

There is transaction for in an out in CTN.

What if someday the product master is change to :
Coca Cola, BTL, DZN 12, CTN 30

Is it problem with this scenario ?

What is the solution for this ?

Thank you.
$firstname = $_POST['firstname'];
      echo 'Your firstname is ' .$firstname. '<br>';
      $secondname = $_POST['secondname'];
      echo 'Your secondname is ' .$secondname. '<br>';
      $location = $_POST['location'];
      echo 'Your location is ' .$location. '<br>';
      $designation = $_POST['designation'];
      echo 'Your designation is ' .$designation. '<br>';
      $fileno = $_POST['fileno'];
      echo 'Your fileno is ' .$fileno. '<br>';
      // date to display
    $rawdate = htmlentities($_POST['doa']);
    $doa = date('Y-m-d', strtotime($rawdate));
      echo 'Your dateofapplication is ' .$doa. '<br>';
    $rawdate = htmlentities($_POST['doj']);
    $doj = date('Y-m-d', strtotime($rawdate));
      echo 'Your dateofjoining is ' .$doj. '<br>';
      $door1 = $_POST['door1'];
      echo ' dooraccess is available for ' .$door1. '<br>';
      $door2 = $_POST['door2'];
      echo 'dooraccess is available for  ' .$door2. '<br>';

      $door3 = $_POST['door3'];
      echo 'dooraccess is available for  ' .$door3. '<br>';

    $door4 = $_POST['door4'];
      echo 'dooraccess is available for  ' .$door4. '<br>';
      $door5 = $_POST['door5'];
      echo 'dooraccess is available for  ' .$door5. '<br>';
      $door6 = $_POST['door6'];
      echo 'dooraccess is available for  ' .$door6. '<br>';
      $door7 = $_POST['door7'];
      echo 'dooraccess is available for  ' .$door7. '<br>';
      $door8 = $_POST['door8'];
      echo 'dooraccess is available for  ' .$door8. '<br>';
      $door9 = $_POST['door9'];
      echo …

we ran out of space on our Exchange 2013 server. After adding extra space to the VM one of our two databases won't mount.

eseutil /mh shows dirty shutdown.

eseutil /ml E01 shows one log has an error - in fact in Windows Explorer it is slightly smaller in size than the rest. There are hundreds of log files and this is the second from last one - the actual last one shows OK, same as the rest.
error cannot read log file header -541

Operation terminated with error -541 JET_errLogFileSizeMismatch, actual log file size does not match JET_paramLogFileSize

How can I get my database to a clean shutdown state? Running the eseutil /r E01 /i /d E:\exchange\database\mbxdb-01
shows the same error as above
Operation terminated with error -541 JET_errLogFileSizeMismatch, actual log file size does not match JET_paramLogFileSize

I am at my wits end. Any help would be most appreciated.

Alasdair Barclay

I just have experience done the basic task of administration and now I have to analyze an Exchange platform (2010 and 2013 coexisting) configured with High Availability, and propose a better arquitecture, including the dismount of the 2010 servers, so I have many doubts and I hope you can help me.

1) when I enter to the ECP to servers I see 6 servers (5 with mailbox function, 3 with client access function and one with hub transport function) but viewing the services by the shell, I see in the 6 active servers the roles of client access server, mailbox server, hub transport server and UM. My question is, is it okay for all roles to be active on all servers? Should it be consistent with the server's functions?

2) The transport function that I see by ECP is in the 210 server that I want to dismount, what steps should I consider?

3) When I look by shell I see the roles (Client Access, Hub transport, mailbox and UM) active in all servers. It is ok that each mail server or CAS have all roles?

4) In addition, I want to use the Exchange calculator to check the current HW against what should be, in the item "Initial mailbox size" I am placing the sum of the databases installed for each server (Tier1 {36000}, Tier2 {956800}. ..) is this way correct?

5) I can not run the BPM in Exchange 2013 is there any alternative way to do it? I had run it in the 2010 server, the results will be ok?

6) In the servers with Client Access Server role only the 2010 has the …
I'm working on a challenge on HackersRank, and brushing up on my SQL skills.  I'm given the following table 'Challenges':

Simple table with hackers and their challengesSo the challenge_id is unique in the table, and hacker_id is the id of the hacker who created the challenge.   I'm trying to meet the challenge step by step, so right now I'm working on what will be an inner query.  

What I'm trying to figure out is how to get a list of hacker_id's where there is no other hacker that created that exact number of challenges.  
Select c2.hacker_id, Count(c2.challenge_id) cnt2 
From Challenges as c2 
Group By c2.hacker_id 
Order By cnt2 Desc;

Open in new window

This query works in getting the number of challenges created by each hacker.  I don't really care about the order in this case, I just have the Order By for viewing intermediate results.

Next, I'm trying to get a list of EITHER all hackers who created a unique number of challenges or who DIDN'T create a unique number of challenges.  Either way works.  Playing around, I tried this:
Select *, count(ch.cnt2) cnt1 From 
(Select c2.hacker_id, Count(c2.challenge_id) cnt2 
From Challenges as c2 
Group By c2.hacker_id) ch, 
Challenges c1
Group By cnt1;

Open in new window

I received the error:
ERROR 1056 (42000) at line 1: Can't group on 'cnt1'

Why can't I group on cnt1?

I want the query to either include or exclude hackers without a unique number of challenges.  
Without changing the approach I'm taking, how can I accomplish this query?
I have used below lines to execute the stored procedure. But it didn't return any results. could you please help me regarding that.

proc sql;
   connect to db2;
   execute (call "DBAB.SP10");






MongoDB (from humongous) is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. MongoDB is developed by MongoDB Inc. and is free and open-source, published under a combination of the GNU Affero General Public License and the Apache License.

Top Experts In