Questions tagged [mongojs]

MongoJS is a Node.js package to access MongoDB.

References:

306 questions
1
vote
1 answer

MongoDb: Is forEach good memory wise?

I have a lot of data to fetch from a mongodb database. I can't load all the data at once on the server because it's too big and I would run out of memory. If I use forEach, will it fetch everything and load everything on the server then apply the…
RainingChain
  • 7,397
  • 10
  • 36
  • 68
1
vote
1 answer

Node/MongoJS and bulk operations

I have a MongoDB 2.6 database. From the mongo shell, I am able to perform bulk operations as expected, and using the Mongo 1.4.9 node driver as well: // bulktest-mongodb.js: works fine var Db = require('mongodb').Db; var Server =…
ECA
  • 33
  • 1
  • 6
1
vote
5 answers

how to query mongodb from nodejs via mongojs module ? (server is openshift)

I was trying out mongodb and nodejs on openshift, using mongojs to interface between nodejs and mongodb. In mongoshell I ran "use nodejs" and defined a "scores" collection. I saved some data in it and its correctly showing. In app.js file of…
codefire
  • 393
  • 1
  • 3
  • 13
1
vote
0 answers

Mongodb find(), limit(), sort() are not working

In my project I need to find the most recent document in collection. I created one but it dose not return anything and I don't where is the problem exactly. Can you help me? Function: DBManagerConnection.prototype.findDeviceLastDeviceActivity =…
user3492113
  • 13
  • 1
  • 6
1
vote
1 answer

MongoDB mongojs node

I'm trying to learn node, mongodb and mongojs and have a newbie question. My route looks like this ... server.get({path: PATH + '/:author', version: '0.0.1'}, msg.findMsgsByAuthor); My JSON looks like this ... { "parentId": "1234", …
mortsahl
  • 602
  • 6
  • 18
1
vote
1 answer

Node.js + mongoDB, error with mongojs $in operator

I am running node.js with mongoDB with mongojs as driver. I have the following issue, I try to query business collection with _id array, if I try to build the query dynamically as below, I get array with length 0 back which is wrong. …
Chidu Murthy
  • 688
  • 3
  • 10
  • 26
1
vote
2 answers

Node.js(express, mongodb) registration process

Hello Stackoverflow community, I'm new to Node.js / express and i need your help because i stuck at some problem. I'm trying to make a registration process where the Post inputs are saved into a mongodb. Before i wanna validate if the users email…
lhadameck
  • 79
  • 1
  • 7
1
vote
1 answer

Sharding not happening

I have created two shards,and applied sharding to the collection posts whose details are as: sh.status() --- Sharding Status --- sharding version: { "_id" : 1, "version" : 3, "minCompatibleVersion" : 3, …
Phalguni Mukherjee
  • 623
  • 3
  • 11
  • 29
1
vote
1 answer

$type for Array field returns false

I have a collection having following data: {"_id" : ObjectId("5220222f8188d30ce85d61cc"), "testfields" : [{ "test_id" : 1, "test_name" : "xxxx" }] } when I query : db.testarray.find({ "testfields" : {…
Phalguni Mukherjee
  • 623
  • 3
  • 11
  • 29
1
vote
1 answer

Checking array type before unwind

I have a document with the following structure {testfields:[{"test_id":1,"test_name":"xxxx"}]}, but , my application don't no whether "testfield" is array or plain object, now if I apply "$unwind" in aggregate query and filed is not of array type…
Phalguni Mukherjee
  • 623
  • 3
  • 11
  • 29
1
vote
1 answer

MongoDB: $push into an array based on a variable's contents

I'm trying to $push an item into my record in MongoDB built on Node (using MongoJS), like so: exports.saveToUser = function (req, res) { console.log("IN"); var user = req.params.user; var param = req.params.param; // equals "foo" …
JVG
  • 20,198
  • 47
  • 132
  • 210
1
vote
0 answers

How to open mongojs editor

OS: Windows7 I installed mongojs using the "npm install mongojs" command. Now, how do I open the mongo.js editor using node.js or cygwin? I googled and youtubed this all day and it seems like a taboo subject. I've successfully created mongodb…
1
vote
2 answers

Equivalent to mongo shell db.collection.runCommand() in Node.js

I'd like to use full text search available in MongoDB 2.4. Text search is available through runCommand function e.g. db.collection.runCommand( "text", { search: "keywords"}). So, I'm wondering whether there is an equivalent to runCommand() function…
1
vote
1 answer

how to know mongodb version through mongojs

dburl = "mongodb://127.0.0.1:27017/demo"; db = require('mongojs').connect(dburl); console.log(db.version); I want to know mongodb version using mongojs.
1
vote
3 answers

Mongojs callback not returning

I am using mongojs to update data in a mongodb collection. The program reads a file line by line and for each line it makes an update in the mongodb database. The update is working fine but the control does not return. var fs = require('fs') var…