MongoDB

116

Solutions

6

Articles & Videos

231

Contributors

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 using php and mongoDb. I am new to mongoDb, but fine with php.  In my mongoDb database I have a  collection called 'users' with a number of fields such as firstname, lastname etc. There are a number of users.


I also have a field/collection in some users called web_links which contains an array.
ie: within my users document:
{
    "_id" : ObjectId("587af11ec09cf31a1955ed92"),
    "username" : "mike",
    "firstname" : "Mike",
    "lastname" : "Tester",
    "email" : "mike@test.com",
    "web_links" : [
        {
            "name" : "google",
            "link" : "https://google.com",
            "status" : "1",
            "added" : ISODate("1970-01-18T08:00:57.600Z")
        },
        {
            "name" : "yahoo",
            "link" : "https://yahoo.com",
            "status" : "1",
            "added" : ISODate("1970-01-18T08:00:57.600Z")
        }
    ]
}

I am trying to firstly update the status of an array item.
I have got as far as this ->

$name = 'google';
$newstatus = '0';

$this->database->users->updateOne(['_id'=>new MongoDB\BSON\ObjectId($userid)],['web_links.name'=>$name],['$set'=>['web_links.$.status'=>$newstatus]]);

This is returning the following error via firebug:
Uncaught exception 'MongoDB\Exception\InvalidArgumentException' with message 'First
 key in $update argument is not an update operator'.

I have tried to change $set to $push, but that is not the answer.

I would be very grateful for assistance …
0
Do you have a plan for Continuity?
LVL 2
Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

I am learning Angular, Node, npm, deployd, mongodb, etc.  I am making my way through a book titled "Pro AngularJS" by Adam Freeman.

on page 120 I am attempting to prepare the data for a "real world" application called "sportsstore".

I was instructed to install a module called "deployd" which apparently is used for modelling  API's for web applications.

I did that and when I try to start start the "deployd" service I get an error:

C:\PROGRA~2\deployd>dpd -p 5500 sportsstore\app.dpd --mongod
starting deployd v0.8.9...
internal/child_process.js:289
  var err = this._handle.spawn(options);
                         ^

TypeError: Bad argument
    at TypeError (native)
    at ChildProcess.spawn (internal/child_process.js:289:26)
    at exports.spawn (child_process.js:380:9)
    at Object.exports.restart (C:\Users\knowlton\AppData\Roaming\npm\node_modules\deployd\lib\util\mongod.js:38:14)
    at Command.start (C:\Users\knowlton\AppData\Roaming\npm\node_modules\deployd\bin\dpd:149:16)
    at Command.listener (C:\Users\knowlton\AppData\Roaming\npm\node_modules\deployd\node_modules\commander\index.js:301:8)
    at emitOne (events.js:96:13)
    at Command.emit (events.js:188:7)
    at Command.parseArgs (C:\Users\knowlton\AppData\Roaming\npm\node_modules\deployd\node_modules\commander\index.js:617:12)
    at Command.parse (C:\Users\knowlton\AppData\Roaming\npm\node_modules\deployd\node_modules\commander\index.js:458:21)
    at Object.<anonymous> 

Open in new window

0
I have a SP in which i need to add one condition to check multiple databases by using sys.dm_database_encryption_keys table. 

when encryption_state is 2 and percentage_completed is 0 in the results it should print. Below is my query



DECLARE @Test varchar(10)
SELECT @Test = Database_ID from 
                             sys.dm_database_encryption_keys  
WHERE Encryption_state = 2 and complete_percentage = 0
If (@test not NULL)
Begin
PRINT("ALTER DB NAme")

If i have multiple DB's which meets the about. It should PRINT multiple ALTER statements with DB Names
0
My data:

Gage_number Latitude    Longitude   Date    Gage_1  Gage_2  Gage_3

1   35.02   -80.84  1/1/2002    0.23    0   0.7
2   35.03   -81.04  1/2/2002    0   0   0.2
3   35.06   -80.81  1/3/2002    3.2 2.1 0.1
This is just a subset of data. I around 50 gauge stations. I want to find spatial auto correction between my gauge stations for rain fall. Based on distance between them. I have created my distance matrix. But I don’t want to use any library in R. I want to do all steps in a function.

loc <- read.table("rain_data.txt",header=TRUE,fill=TRUE)  
gauge.dists <- as.matrix(dist(cbind(loc$Latitude, loc$Latitude))) #distance matrix
Now since distance between gauges is not uniform. I want to use a certain bin size to decide about distance lags.

Pseudocode:

If the distance between guage pair 1-2 is 1 meter then assign a distance lag of 1 and so on So Lag 1=intergage dist=1 meter. So Lag 5=intergage dist=5 meter After creating that matrix I will find autocorrelation between gauge pairs.

so for lag 1 intergage dist=1 for lag 5 intergage dist=5

Gage pair   date    RainA   RainB       Gage pair   date    RainA   RainB

1-2 1/1/2002    0.23    0       1-3 1/1/2002    0.23    0.7
1-2 1/2/2002    0   0       1-3 1/2/2002    0   0.2
1-2 1/3/2002    3.2 2.1     1-3 1/3/2002    3.2 0.1
I have a hard time translating it into loop or a function. Any ideas?
0
Using Database 11g Release 2

When I run the following pl/sql script :

BEGIN
  FOR comp IN (SELECT val FROM productTable@remote_link2 WHERE PRODUCT_ID = 1111)
  LOOP
    DBMS_OUTPUT.PUT_LINE(comp);
  END LOOP;
END;

I get the error :
ORA-06550: line 2, column 34:
PL/SQL: ORA-00942: table or view does not exist
ORA-06550: line 2, column 16:
PL/SQL: SQL Statement ignored
ORA-06550: line 4, column 26:
PLS-00364: loop index variable 'COMP' use is invalid
ORA-06550: line 4, column 5:
PL/SQL: Statement ignored
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

But when I run as pl/sql only the select statement in the for loop :
SELECT val FROM productTable@remote_link2 WHERE PRODUCT_ID = 1111;
I get the results.

Is the database link not compiling properly in a for loop?
0
Hi,
I am working on the vehicle details normalization but I am not sure it is correct or not. could you check it for me please? -we have: vehicle make, manufacturer, model, colour, type, fuel, year and safety.
I have no idea about year and safety . Thanks for your help.



manufactures(manufactur_id, manufactur_name, manufactur_address, manufactur_website)

vehicle_model(model_id, model_name, manufactur_id(fk))

vehicle_colour(colour_id,colour)

fuel(fuel_id,fuel_type)

type(type_id,type_description)

(year,safety)

vehicle(vehicle_id, colour_id(fk), model_id(fk), fuel_id(fk), type_id(fk), ......)
0
I am wondering how to make it, so that a Bartender Data Entry form can, not only pull up data from 3 separate Tables to print on a label (which I can already do), but when you click "Print" it saves all that data into a 4th table. A row of data per print.
0
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");
quit;
0
I have this reporting project that involves 3 data sources, 2 of the 3 data sources are structured data (SQL Server and Oracle), the 3rd data source is flat files by which I have do lots of parsing, so the question is, how would you approach such project? How would you deal with the flat files, I have my own thoughts but I'm interested in your thoughts on the matter.

Many thanks
0
Hello I have query to clacultae the balacy of customers in my SQL
I want   The Previous Balance to be added to current transaction
Result would look like :  Balance = Sale+Hadnling+Freight+PreviousBalance  .
This is My query:
SELECT
jklnzhang.id,
jklnzhang.Customer,

jklnzhang.SaleAmount,
jklnzhang.Handling,
jklnzhang.Freight,



jklnzhang.SaleAmount + jklnzhang.Handling+jklnzhang.Freight+ifnull(totaldepnsebycalno.Depense,0) AS Balance,
jklnzhang.Editor,
CustomerBalance.Balance AS Reall,
jklnzhang.dasuanzhanghao AS CBM,
TransfertTotalByCalNo.IcomeAmount,
jklnzhang.SaleAmount + jklnzhang.Handling+jklnzhang.Freight+ifnull(totaldepnsebycalno.Depense,0)  -IFNULL(TransfertTotalByCalNo.IcomeAmount,0) AS OtherThing
FROM jklnzhang
LEFT OUTER JOIN CustomerBalance ON jklnzhang.Customer = CustomerBalance.CustId
LEFT OUTER JOIN TransfertTotalByCalNo ON jklnzhang.CalNo = TransfertTotalByCalNo.CalNo
LEFT OUTER JOIN totaldepnsebycalno ON jklnzhang.CalNo = totaldepnsebycalno.CalNo
ORDER BY jklnzhang.Customer
0
Webinar: Security & Encryption in the MySQL world
LVL 2
Webinar: Security & Encryption in the MySQL world

Join Percona’s Solutions Engineer, Dimitri Vanoverbeke as he presents “Security and Encryption in the MySQL world” on Thursday, July 6, 2017 at 7:00 am PDT / 10:00 am EDT (UTC-7).

Where can I buy or find an open source for  icd 10 complete database that  has the includes and excludes table mapped to diagnosis codes and check for conflicts on each code pair.
0
I heard that replication (master slave) can help minimize outages due to heavy schema changes, yet I'm not sure I fully understand that!
1-Do we run changes on the slave then promote that slave to master? If so how is it possible to write to master?
2-what are the cases where replication can help with avoiding or minimizing outage?
0
Creating View: VW_SHP_PR_PU_CU_REPORT1
MTK-15008: Error Creating View: VW_SHP_PR_PU_CU_REPORT1
DB-42804: ERROR: UNION types text and numeric cannot be matched
0
I have an SQL database setup like this:

Students
========
ID
StudentName
StudentID

Courses
=======
CourseID
CourseTitle
SubjectArea

Assignments
==========
AssignmentID
CourseID
AssignmentTitle
PossiblePoints
DueDate

StudentCourseEnrollments
======================
StudentID
CourseID

Grades
======
StudentID
AssignmentID
Grade
Comments


I would like to display the data in a gridview that can be edited inline when a user clicks into a datagrid cell and changes saved back to the server database backend for quick user interaction editing as follows:

Student Name (Last, First)          | HWK 1 | QUIZ 2 | Project 3 |
==================================================
Test Student                                 | 100       | 50         |   90
==================================================
Test Student 2                              |90          |100        |  75
==================================================

As you know, he traditional gridview only allows for rows to repeat not to be listed ion a pivot form, and definitely not edited. I am coding in VB.NET. Help would be greatly appreciated as i am stuck.
0
I have already tables and I want to apply fuzzy logic on some attributes ( fuzzy sets , membership functions, fuzzification , defuzzification  ..etc) but I do not how to start. I have used SQL SERVER.
0
hi how can i reset global variable in oracle form 11g i have the following block IN MY when-new-form-instance


:block_home.enter_employee_id := substr(:global.ent_empid,1,4)||' - '||substr(:global.ent_ent_empid,5,2)||' - '||substr(:global.ent_empid,7,3)||' - '||substr(:global.ent_empid,10,4);	
:BLOCK_HOME.CURR_employee_id    :=substr(:global.uni_empid,1,4)||' - '||substr(:global.uni_empid,1,2)||' - '||substr(:global.uni_empid,3,3)||' - '||substr(:global.uni_empid,6,4);

Declare
	Cursor C_jobs 
	  is
	  Select employee_id, start_date, end_date,
	         job_id, department_id 
	         from hr.job_history
	         where employee_id = substr(:global.uni_empid,5,9); --am geting value as -18-047-6 instead of 5320180476694 how can i resert :BLOCK_HOME.CURR_employee_id
begin
	go_block('job_history');
	-- first clear the block if it contains any records
	clear_block(no_validate);
	-- move control to first record;
	first_record;
	for cur in C_jobs loop
		 :job_history.employee_id := cur.employee_id;
		 :job_history.start_date := cur.start_date;
		 :job_history.end_date := cur.end_date;
		 :job_history.job_id := cur.job_id;
		 :job_history.department_id := cur.department_id;
		 -- move control to next record;
		 next_record;
	end loop;
	-- again after completion move control to first record
	first_record;
	
end;

Open in new window

0
Given following condition:
-when payment made, update system invoice status
-when payment made, payment gateway send direct and indirect(return to website page) response.
-sometimes user does not complete payment or response not sent/receive.
-Payment gateway API has re-query feature to query for latest status of the payment.
-my invoice void and item released if it exceed 30 minutes. (a job runs every minute)

How should i design the flow logic? i.e the requery mechanism.
How should i design the database and track the payment status, track the responses, and the status of re-query job?
0
Hi All,

I would like to get the gaps between date range and needed it to separate the gaps by MM ID.

could you please someone help me to resolve below in Netezza

INPUT:

ID | MM Number | From | To
12345|4444444 |2015-01-03 |2015-02-02
12346|4444444 |2015-02-03 |2015-03-02

<< missing one record ( ex same MM Number no record for period from 2015-03-03 to 2015-04-02

12347|4444444 |2015-04-03 |2015-05-01
12348|4444444 |2015-05-02 |2015-06-01
12349|4444444 |2015-06-02 |2015-07-01
12310|4444444 |2015-07-02 |2015-07-31

<< missing one record (ex: same MM Number no record for period from 2015-08-01 to 2015-08-31

12310|4444444|2015-09-01|2015-09-30



Expected Out put:
MM No | Missing Start Date | Missing To Date
4444444 |2015-03-03 |2015-04-02
4444444 |2015-08-01 |2015-08-31

I've a table with below data

create table icr_tmp
(
ID VARCHAR2(15),
NMI VARCHAR2(50),
INVOICE_START_DATE DATE,
INVOICE_END_DATE DATE);

insert into icr_tmp
values('12345','4444444','03/01/2015','02/02/2015');

insert into icr_tmp
values('12346','4444444','03/02/2015','02/03/2015');

insert into icr_tmp
values('12347','4444444','03/04/2015','01/05/2015');

insert into icr_tmp
values('12348','4444444','02/05/2015','01/06/2015');

insert into icr_tmp
values('12349','4444444','02/06/2015','01/07/2015');

insert into icr_tmp
values('12310','4444444','02/07/2015','31/07/2015');

insert into icr_tmp
0
I re-install the software and it keeps show the message please see the attachment
timetrax.jpg
0
Webinar: MariaDB® Server 10.2: The Complete Guide
LVL 2
Webinar: MariaDB® Server 10.2: The Complete Guide

Join Percona’s Chief Evangelist, Colin Charles as he presents MariaDB Server 10.2: The Complete Guide on Tuesday, June 27, 2017 at 7:00 am PDT / 10:00 am EDT (UTC-7).

how to compare 2 table from two different oracle database.
DBMS_COMPARISON? how much cost in my perf. databases.
i have two databases the prod and test. test base is not update or delete. i mean compare should be one way.
any idea. (only 5 huge table).
0
Hi Experts,

I have established a readonly routing connection and verified with Data source  OLEDB for a SQL Server Reporting server. But with OLEDB we are getting below error:
Error:
Cannot add multi value query parameter '@processid' for dataset 'batch_process_audit' because it is not supported by the data extension. (rsErrorAddingMultiValueQueryParameter)
----------------------------
An error has occurred during report processing. (rsProcessingAborted)
 
OLEDB Command used:
Provider=SQLNCLI11;Data Source=xyz;Initial Catalog=Testdb;ApplicationIntent=ReadOnly;MultiSubnetFailover=True.

To resolve the error we have to change in reports but our client is not ready to change anything in the SSRS.

Therefore we want to create a connection with Data source type as 'Microsoft SQL Server' in SSRS server. But am getting the below error.
Please verify the error and provide the solution.

error:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The remote computer refused the network connection.)

The below command used for to connect SSRS server using data source Microsoft Sql server.
command:
Data Source=L-IHB2014P.ib.local;Initial Catalog=ihbprod;ApplicationIntent=ReadOnly;MultiSubnetFailover=True

Thanks,
Sreenivasa
0
Suppose,In your project lots of developer are working ,each developer has changed their own table ,I want to manage it through versioning.
How to manage it ? which tools should be used to manage it ? what will be best possible approach ?
0
I have the code in the pastes ,Login.jsx pastebin.com/GnK5GYui, main.jsx, pastebin.com/nLBgTQwC, Server main.js pastebin.com/w983EAEN, main.html pastebin.com/sY5wgGKW. With all this and Mongo backend, I am trying to comeup with a login page which does login authntication of the username and password entered. I need to know how to do so.
0
I had this question after viewing Missing OWC10.dll version 1.2 Reference.

In Access 365, it states "your MS Access database contains a missing or broken references:  OFFOWC.DLL" and I was finally able to go into visual basis and remove it.  However, for Access 2010, I am NOT getting that message nor does it show anything is broken but it is not performing a certain calculation calling Running Totals.  In 365, once I remove that reference, then it does show the Running Totals.  Not sure what else to check.

This database and another one:  Was Access 2002 and I converted to Access 2010.

Any help would be appreciated.

Thank you.
0
Issue:
I have two Exchange 2010(all-in-one) servers in a DAG. EX1 in Production site and EX2 in DR site.
I configured the DC1 in Production site as witness server and DC2 in DR site as alternate witness server.
When the link between Production & DR site lost, all databases in EX1 will be dismounted.

Question:
Should I only set one Witness server only? If so, remove the one in DR?
How to verify whether the Witness server role is working?
0

MongoDB

116

Solutions

6

Articles & Videos

231

Contributors

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
MongoDB