Questions tagged [mongojs]

MongoJS is a Node.js package to access MongoDB.

References:

306 questions
0
votes
1 answer

No blocking operation in MongoJS

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…
user2369478
  • 63
  • 11
0
votes
1 answer

node.js - newbie mongojs issue

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 =…
julian
  • 4,634
  • 10
  • 42
  • 59
0
votes
1 answer

MongoJS: size() method or length not available

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…
David
  • 560
  • 2
  • 10
  • 26
0
votes
1 answer

clear Mongojs collections after execution

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…
codejammer
  • 469
  • 1
  • 7
  • 18
0
votes
1 answer

mongojs [Error: connection closed ]

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…
0
votes
1 answer

mongojs: pushing elements into fields of arrays

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, …
Sovos
  • 3,330
  • 7
  • 25
  • 36
0
votes
1 answer

socket.io returns [object Object] from mongojs query

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…
mackwerk
  • 1,689
  • 4
  • 21
  • 44
0
votes
1 answer

How do I pass variables in mongojs query in the key name

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…
Sudhanshu
  • 6,893
  • 3
  • 19
  • 10
0
votes
2 answers

Cannot call the method save of undefined. Mongojs

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…
hughesdan
  • 3,019
  • 12
  • 57
  • 80
-1
votes
1 answer

Running ‘db.command(eval(commandString));’ gets me ‘MongoServerError: command not found’

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…
eizo9
  • 1
  • 3
-1
votes
1 answer

Node Server unable to respond to PUT request

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…
Jack Sylvane
  • 59
  • 2
  • 8
-1
votes
1 answer

throw new TypeError('Router.use() requires middleware function but got a ' + gettype(fn));

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…
-1
votes
1 answer

Unable to connect and query mLab database using mongojs

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 =…
Ahsan Attari
  • 987
  • 3
  • 12
  • 26
-1
votes
1 answer

Why find statement in MongoLab with Heroku return undefined?

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…
crissilvaeng
  • 165
  • 1
  • 12
-1
votes
1 answer

Node.js : How to check if mongojs connected successfully?

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?
Mladen Kajic
  • 125
  • 1
  • 2
  • 7
1 2 3
20
21