Questions tagged [mongojs]

MongoJS is a Node.js package to access MongoDB.

References:

306 questions
0
votes
0 answers

MongoDB aggregate to find first document with value greater than n

Given a LARGE (hundreds of thousands) collection of event documents (see below for example), what is the most performant method to retrieve the first event with an _id greater than (n) ? Example Document { _id: NumberLong(352757), // Uniqueness…
0
votes
1 answer

Node.js mongojs mongoDB internet layer

I have looked everywhere, cannot find what protocol the mongojs uses for connecting with the mongodb. Can anyone show me some doc's that specify if its UDP or TCP/IP or HTTP
MRK187
  • 1,545
  • 2
  • 13
  • 20
0
votes
1 answer

Inserting into MongoDB using Node js

Inserting into Mongo DB using the mongojs module fails cryptically,I have two functions,setupMongoDB and pushRequestsToMongoDB(what they do is self-explanatory). I get a request from my web-page and parse the data to JSON. The console looks like…
vamsiampolu
  • 6,328
  • 19
  • 82
  • 183
0
votes
1 answer

Moving MongoDB to Multikeys but indexOnly is returning false

What I'm trying to do sounds logical to me however I'm not sure. I am trying to improve part of a MongoDB collection by using Multikeys. For example: I have multiple documents with the following format: Document: { "_id":…
Levi Roberts
  • 1,277
  • 3
  • 22
  • 44
0
votes
0 answers

MongoDB - Insert JSON with $set

I need update my document by inserting {four: five, six: seven} in three db.collection.findAndModify({ query: {_id: doc._id}, update: { $set: {one: two, three: {four: five, six: seven}}, $unset: {eight: ""} }, new:…
fran.tr
  • 1
  • 1
0
votes
1 answer

Using mongojs and node.js, how to find documents using multiple attributes as criteria

I am trying to use the find method to return documents that meet multiple criteria like so: db.issues.find({ 'title.name': name, 'title.year': year, 'title.publisher': publisher }, function(err, issues) { ... I get an empty array back as a…
bbeny
  • 632
  • 1
  • 7
  • 18
0
votes
1 answer

search monodb using number from nodejs using mongojs

I am using mongojs in nodejs to access mongodb. I am trying to find records based on the "SOLUTION_TEST Number" as the where condition. db.stories.find({"SOLUTION_TEST Feature" : req.query.data},function(e,docs){ console.log(docs); …
Gyandeep
  • 12,726
  • 4
  • 31
  • 42
0
votes
1 answer

mongojs notation with $set

This is how a mongojs objects gets updated: db.books.update( { _id: tg._id }, { $set: { comment: "Hello", }, }, This assumes that there is a property called 'comment'. You can do…
0
votes
1 answer

Code not terminating

I am using twitter API in my code and mongodb. The is reflecting the correct output in database, but it's not terminating. I guess the problem is with db.server.find({id:myid},cb); statement in code below. However, I don't know how to work it…
jayesh hathila
  • 279
  • 1
  • 6
  • 14
0
votes
1 answer

How do I get n set of documents in a sequential order Mongodb

I have my server with the route as "q=word/s=0/t=5" where q is the query string, s is the starting document and t is the limit. So for the first request I would query the documents based on q and would show the results from 0 to 5 of the results…
0
votes
1 answer

MongoJS runcommand for mapreduce returning error

I'm able to run the simple {ping:1} command with MongoJS in NodeJS, but when I try to run the mapreduce command I'm receiving an error. I've googled the crap out of the error and can't seem to find a resolution anywhere. Successful…
selanac82
  • 2,920
  • 4
  • 27
  • 37
0
votes
1 answer

Collect data recursively in nodejs and then delete it one by one

infom_col is a collection which contains a field rkey which itself contains an array like this: rkeys -> brands so brands is an array of ids. These ids are reference to other documents in the collection. I need to collect all such dependent ids and…
blackmamba
  • 1,952
  • 11
  • 34
  • 59
0
votes
1 answer

mongodb mapreduce does incorrect reducing

I'm running into some trouble with a very simple mapreduce, I can't figure out what I've done wrong. I'm trying to merge two collections together, and this first, db.Pos looks like this "chr" : "chr1", "begin" : 39401, "end" : 39442 The other…
0
votes
1 answer

Hidden replica set do not take part in election

I have a replica set of three server and a backup server, The backup server is made "hidden"=true and "priority"=0` My concern is when I have one of my secondary and backup server up, my secondary does not changes into primary, which means hidden…
Phalguni Mukherjee
  • 623
  • 3
  • 11
  • 29
0
votes
1 answer

How do I re-direct output in mongo JS

I have something like below in my mongo js file db.eval(function(){ db.user.find( { email : {$exists : false}} ).forEach( function(found){ id = found._id; print(id); // this will print to mongo logs print() will…
NewQueries
  • 4,841
  • 11
  • 33
  • 39