Articles & Videos



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

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

Webinar: Choosing a MySQL HA Solution
Webinar: Choosing a MySQL HA Solution

Join Percona’s Principal Technical Services Engineer, Marcos Albe as he presents Choosing a MySQL High Availability Solution on Thursday, June 29, 2017 at 10:00 am PDT / 2:00 pm EDT (UTC-7).

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!
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.
Get Database Help Now w/ Support & Database Audit
Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

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

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 …
Webinar: MongoDB® Index Types
Webinar: MongoDB® Index Types

Join Percona’s Senior Technical Services Engineer, Adamo Tonete as he presents “MongoDB Index Types, How, When and Where Should They be Used?” on Wednesday, July 12, 2017 at 11:00 am PDT / 2:00 pm EDT (UTC-7).

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 am migrating my 2008 databases to 2012 and only want to migrate Database that are used the most frequent by determining the Last Used / Updated Date. Not the create date or modified date.

My SQL 2008 R2 has 48 database that were created, only a few that haven't been used in years. And others that are being used more frequently. Knowing the Table Dates/Times may be needed in time, and that's where my sql script below will help. But what I'm specifically looking for is the Main Database List.

The following sql script I am able to determine a specific Database (HTEDTA Files) as in the code below:
SELECT    [TableName] = OBJECT_NAME(object_id),
last_user_update, last_user_seek, last_user_scan, last_user_lookup
FROM    sys.dm_db_index_usage_stats
WHERE    database_id = DB_ID('HTEDTA Files')
Order by TableName
Hello. I will be working on a project to convert old MS Access .mdb file databases created with Access 2003 to .accdb databases for Access 2016. I would like to have Access 2003 which comes with Office 2003 Professional so I can create sample .mdb databases to test for potential conversion problems and to make changes as needed to the 2003 .mdb files to make the conversions work.

Where can I buy a legitimate and trusted Office 2003 Pro product (preferably an ISO download to allow loading into a virtual machine easier)? I've seen some offers on but see some complaints the provided serial numbers have already been used or activations have already been maxed out. I've also seen complaints that buying from e-bay is risky because you don't know if they are legitimate.
Hi i have the following function am geting this error when i pass value
   RETURN number

   wrk_sin number;

   lsNSN    VARCHAR2 (255);
   lnAccnr    ITEM_BASIC.SIN%TYPE;

   c_cnt_acc number(10);


     INTO lnRow
             FROM ITEM_BASIC a
            where a.ITM_CODE = regexp_replace(vsInput,'[^[:digit:]]')
           UNION ALL
           SELECT *
             FROM ITEM_BASIC a
            WHERE ITM_CB||ITM_NR||ITM_NAME = vsInput)
    WHERE ROWNUM <= 1;

   IF lnRow.item_type = '9' then
        INTO lnCode
        FROM (    SELECT *
                    FROM ITEM_DATA
              START WITH ITM_CODE = lnRow.ITM_CODE
              CONNECT BY NOCYCLE PRIOR TO_CODE = ITM_CODE)            


    lnAccnr := lnRow.ITM_CODE;
   END IF;

   RETURN lnAccnr;


      raise_application_error (-20001, SQLERRM);


   (ITM_CODE NUMBER(11,0) primary key, 
    accountNr varchar(20),--accountNr=ITM_CB||ITM_NR||ITM_NAME
	accountNrTo varchar(20),
   (ITM_CODE NUMBER(11,0), 

Open in new window

I have been given a text file which I need to place the data into a MySQL table, Excel or Even Access.

The text file contains:
A | win
B | howdy
C | go home
D | have lunch
A | happy
B | sad
C | drunk
D | mad

The letters on the left of the | are the field names and the data is on the right.
There is no character/delimiter that represents the end of a record.
There are thousands of these records containing the same fields in the same order (obviously different data).

Any suggestions in getting it in to columns of data instead of rows would be appreciated.
What software was used for backend database in any website?

For example, SQL, MySQL, MariaDB, etc. like this.





Articles & Videos



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