I have to do an operation that calculate for me something, but I can't use the result of it, because I always stay in a wait state, in fact in my terminal remains in execution my program until I enter ctrl+C.
I have a main in nodejs for my program…
I am trying to learn MongoJS, But its not working.
I wrote this code so far -
/* Basics */
var express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io').listen(server),
db =…
I just installed the latest versions of node.js and MongoDB and a driver for node.js: MongoJS
Now I tried to find out (with good performance due a high load app) if a record exists in the database. I tried this query but all I get is an error:
var…
I have 2 functions which uses mongojs to connect. Both will use 2 different collections with different schemas but with same name "users". Here is the code :
var findAll = function(req, res) {
var users = db.collection('users'); //this initializes…
I'm using mognojs version 0.7.2 and socket.io, and works fine but when I don`t make queries to datatabase for a while, maybe a timeout close the connection, and after when i try to make any query again the callback response is [Error: connection…
I searched a lot on this topic, but I'm just totally lost.
Here is my problem (I'm using node.js with mongojs):
I'd like to have this kind of documents:
{
"_id" : ObjectId("50ce2f7f98fa09b20d000001"),
"beginTime" : 1355689855016,
…
I've started looking at socket.io and some MongoDB with mongojs.
Summary: Client doesn't send data to server through socket.io so mongojs doesn't have anything to look for and just returns first document in collection, I'd like it to return null or…
Each document in my users collection looks like this:
access: { 123456789012345678901234: 3, 123456789012345678901235: 2, 123456789012345678901234: 1, 123456789012345678901236: 0 }
I'm trying to find all records which have…
I have a simple method as follows to write to a mongodb database. It uses the Mongojs module. Everything seems fine with the exception of the last line. I'm getting "TypeError: Cannot call method 'save' of undefined" in the console. What could…
I have a JS application where I have a mongodb driver. After connecting to it I try to run
const result = await db.command(eval(commandString));
in order to run diverse types of commands into my database from a string, for…
I am making a quite easy CRUD application in MEAN stack.
I have succesfully done all but Update function. Problem is not with request itself but inability of Node server to respond. Request is making changes to database as requested and I even eget…
I have created an express application with MongoJS. I am returning a function, still it's showing an object has been returned. I have even added module.exports=router in my JavaScript page. Can someone please point out the missing export…
I am new to MongoDB and I started to make a test app which looks like this:
server.js
var express = require('express');
var path = require('path');
var bodyParser = require('body-parser');
var index = require('./routes/index');
var tasks =…
I am now using Node.js in a Heroku App with a MondoDB in MongoLab service. I put in a collection in localhost DB and on MongoLab the nextdocument.
{
"person": "Jon Smith",
"age": 57
}
And then I use the next script for get the document.
var…
Im making a server and need some way to be identified if mongojs connected successfully to the mongodb database when i call the function :
mongojs.connect(connectionString, collections);
Is there a callback or an event listener i could use?