473,385 Members | 1,615 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

my mongo database not connect with my node server.................

14
hi help me,
my mongo database not connect with my node server. here my code.

Expand|Select|Wrap|Line Numbers
  1. .................controller.js...............
  2.  
  3. function AppCtrl($scope,$http){
  4.     console.log('hello 123456789')
  5.     $http.get('/contactlist').success(function(response){
  6.         console.log('i requested')
  7.         $scope.contactlist = response;
  8.     });
  9.  
  10. $scope.addContact = function(){
  11.     console.log($scope.contact)
  12.  
  13.     $http.post('/contactlist', $scope.contact);
  14. };
  15.  
  16.  
  17. };
  18.  
  19. .....................server.js................
  20.  
  21. var express = require('express');
  22. var app = express();
  23. var mongojs = require('mongojs');
  24. var db = mongojs('contactlist', ['contactlist']);
  25. var bodyParser = require('body-parser');
  26.  
  27. /*app.get('/', function(req,res){
  28.     res.send('hello world from server.js')
  29. });*/
  30.  
  31. app.use(bodyParser.json());
  32.  
  33. app.use(express.static(__dirname + '/public'));
  34.  
  35.  
  36. app.use('/contactlist',function(req,res){
  37.     console.log('server saying: i received a get request')
  38.  
  39.     db.contactlist.find(function(err,docs){
  40.         console.log(docs);
  41.         res.json(docs);
  42.     })
  43. });
  44. app.post('/contactlist', function(req, res){
  45.     console.log(req.body);
  46. })
  47.  
  48.  
  49.  
  50. app.listen(3000);
  51. console.log('server:i am running');
  52.  
plz help me
Nov 20 '15 #1
5 1420
zmbd
5,501 Expert Mod 4TB
>OK<
1) More detail such as any errors (detailed) and what it is doing versus what you expected.

2) You need to do the basic trouble shooting first. Using your debugger, step thru the code. Make sure that all of your strings are resolving correctly, etc...
Nov 20 '15 #2
izawad
14
i am trying many time but no one error is showing. i am to confuse where my mistake?
how can get and post data in mongodb?
my problem is
when i post my data server does not get my post. and error is not shown into console. what can i do?
Nov 21 '15 #3
zmbd
5,501 Expert Mod 4TB
Izawad,

With a caveat emptor in place - namely, that I don't have much knowledge of MongoDB and JAVA appilications :) -
I don't see where the actual connection is made to the database...

Do you have the instance started for the database?

I don't know how exactly you are implementing the MongoDB, there appears to be a few methods to do this; thus, here's the tutorial homepage for MongoDB/JAVA via MongoDB site: Getting Started with MongoDB (Java Edition)

+ This is another site I use for tutorials, this is the root page so that you can double check one method of installation.
MongoDB - Java

++ I wish that could be of more assistance to you in this matter; however, as afore mentioned, I have no experience with MongoDB and JAVA. Hopefully one of our experts more versed in this will be able to provide some better guidance :)
Nov 21 '15 #4
izawad
14
thanks dude
i am trying and searching where my problem? thanks for guidance may be i have window 32 bit therefore mongodb is create problem.
Nov 22 '15 #5
zmbd
5,501 Expert Mod 4TB
There appears to be a stable 32bit version for download:
www.mongodb.org>Download MongoDB
Nov 22 '15 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

33
by: Savas Ates | last post by:
in asp page im getting this error how can i solve it.. yesterday the codes work but i setup visual studio 6.0 now it doesnt works..
4
by: Nanda | last post by:
hi, how to create database in mssql server using c#. We can create msacess database using adox, similiarly how to create sql server database using c#. Regards, Nanda.
2
by: C#User | last post by:
hi, For the local sql server, the connection string is like: Data Source=(local);Integrated Security=SSPI;Connection Timeout=5;DataBase=northwind But for another sql server on another domain,...
2
by: Scott Baxter | last post by:
Is there a way to create a brand new database on the server? Someone gave me the asp code below, but I haven't gotten it to work yet. Thanks for any help. <% Dim strSQL Dim cnnTest
1
by: Daniel Manes | last post by:
Some facts: 1) I have an Access database (.mdb file) sitting on my harddrive. 2) I have Visual Studio 2005, Sql Server Express, and Sql Server Management Studio Express. 3) I do *not* have...
2
by: Tor Inge Rislaa | last post by:
Database on remote server On the remote server where my ASP.NET application is located there is no SQL Server or SQL Server Express. When I test my application locally it works fine because...
2
by: Seven | last post by:
Hi, When I right-click the View Node of a database connection (in server explorer), I only get the 2 choices: "Refresh" and "Properties". Therefore I was wondering how can I set up Visual...
15
by: rajbala | last post by:
hi all, I got the error like $ mysqladmin -h localhost -u root -p create bedrock Enter password: ****** mysqladmin: connect to server at 'localhost' failed error: 'Access denied for...
3
by: joysana | last post by:
Hi, Dear friends, how can I connect database MS SQL server mobile sersion 2005 using mobile tools with C#. and what is requirements? .....joy
0
by: vidhyaG | last post by:
Hi, i have a database in my ftp server.and i am developing windows application using C# language.now i want to connect a database from ftp server.i tried but it did not work....so,help me... ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.