Questions tagged [mongojs]

MongoJS is a Node.js package to access MongoDB.

References:

306 questions
0
votes
1 answer

Why my nodejs script didn't quit to shell?

My code looks like this: #!/bin/env node var collection = require('mongojs')('test').collection('test'); collection.findOne({}, function(err, doc) { console.log(err, doc); }); When I ran this script, it showed: $ node test.js null null But…
Tyr
  • 1,039
  • 1
  • 14
  • 15
0
votes
1 answer

mongojs replacing document with update command

With mongojs we need to update the document with something like below given code db.data.update( { "title": {$regex : '.*Green Red.*', $options : 's'}, "editor.key": {"$in": ["74014","45339"]},`enter code here` "types" : "Notes" …
0
votes
0 answers

db.printCollectionStats() error

I am getting the following error when I run: db.printCollectionStats() error: { "$err" : "stale config on lazy receive :: caused by :: $err: \"[myzips.zips] shard version not ok in Client::Context: this shard contains versioned chunks for…
Phalguni Mukherjee
  • 623
  • 3
  • 11
  • 29
0
votes
1 answer

MongoDB update query not working

I am running the below query and It does not work. When I run the query part in mongo UI, it returns me expected result. I am using UMongo. But it does not update the document as expected. db.system.js.save ({ _id:"script_1", value: function()…
NewQueries
  • 4,841
  • 11
  • 33
  • 39
0
votes
0 answers

Updating or adding sub document

I am struggling with very weird problem in MongoDB, what I want is that the query updates document if the condition matches and if not creates new (upsert). The problem: I get the correct results from the callback, as this returns the newly inserted…
Risto Novik
  • 8,199
  • 9
  • 50
  • 66
0
votes
1 answer

Query related to production environment

I have configured my production environment with the following details: 1. Three config server 2. Two router(mongoose) 3. Two shards of three replica set. My question is, I am trying to connect to the sharded database with the help of mongo java…
Phalguni Mukherjee
  • 623
  • 3
  • 11
  • 29
0
votes
3 answers

Coffeescript class find or create mongo document

I'm trying to write a coffeescript class that when constructing a new object from it, it checks to see if an ID was passed. If so, try to find a document matching and populate object from that. If no ID is passed, generate a new ID an create a new…
Kylee
  • 1,625
  • 1
  • 31
  • 54
0
votes
1 answer

Why won't my express.js run?

I have an express.js app that get to this: node app.js info - socket.io started And it won't get any further, if anyone can explain why this happens and how to fix it, it would be greatly appreciated. I believe the error is in my app.js which is…
Christian Grabowski
  • 2,782
  • 3
  • 32
  • 57
0
votes
1 answer

Iterating in the reduce function without knowing the key name

I have a map functions as: emit(this_id,this), now I want to iterate through each key in the reduce function,is their a way I can proceed with this problem, having no clue how to proceed.
Phalguni Mukherjee
  • 623
  • 3
  • 11
  • 29
0
votes
2 answers

NodeJS - Is Mongoose faster than MongoJS?

I've got an application that runs on NodeJS, and uses MongoDB as a database for information. Currently I hook into MongoDB via the MongoJS module, which aims to "emulate the official mongodb API as much as possible". The application gets about…
JVG
  • 20,198
  • 47
  • 132
  • 210
0
votes
1 answer

Mongojs print and console.log not working

I am running the following command and I want to see the output in my out.log file but it is not printing anything. /tmp/mongodb/bin/mongo mydatabase_name /tmp/mongodb/scripts/test.js >> out.log These are the contents in my…
NewQueries
  • 4,841
  • 11
  • 33
  • 39
0
votes
1 answer

Terminate mongodb connection in a callback

I'm just learning mongojs and nodejs so I'm still trying to get used to programming asynchronously. What my program should do is take input from a file ('list'), read each line and pass the line to a parse function which writes data to a file and…
0
votes
1 answer

why update doesn't work

I pass a json variable to a module but I can't do the update of my collection, always I have an error in the updating. var gestion = function(myJSON) { var dburl = 'localhost/mongoapp'; var collection = ['clientes']; var db =…
user2369478
  • 63
  • 11
0
votes
1 answer

How do I store a mongojs query result to a variable

All i get from this code: var views = db.books.find({"number":1}, {"views":1, _id:0}); console.log(views); is this response: { _readableState: { highWaterMark: 16384, buffer: [], length: 0, pipes: null, pipesCount: 0, flowing:…
user1710631
  • 103
  • 1
  • 1
  • 5
0
votes
2 answers

how to wait the end of the execution of a function

I have a main in nodejs for my program where I need to use my result calculated in a module, but my I don't have the right result. var myJSONClient = { "nombre" : "", "intervalo" : [0,0] }; var intervalo =…
user2369478
  • 63
  • 11