Questions tagged [mongojs]

MongoJS is a Node.js package to access MongoDB.

References:

306 questions
3
votes
1 answer

Issues with mongodb/nodejs/express/mongojs and findAndModify

Currently doing a online course to learn some Node.js, Express, and MongoDB. In this course there is a api section where they teach you to do simple stuff, but i ran in to an issue, the course video shows him updating name of an item, and the api…
Benzon
  • 119
  • 6
3
votes
1 answer

How to access mongo replica set if the majority server are down?

I have 3 mongo server configured as replica set like this: MY-PC:27017 -- Primary - DOWN MY-PC:26017 -- Secondary - ACTIVE MY-PC:25017 -- Secondary - DOWN If 27017 and 25017 go down, how do you access data in sole-survivor, 26017 ? I found that…
DennyHiu
  • 4,861
  • 8
  • 48
  • 80
3
votes
2 answers

require("mongojs").connect is undefined

I just started to learn mongodb. I tried the following code in my app.js var databaseUrl = "localhost:27017/pixelmargin"; // "username:password@example.com/mydb" var collections = ["pages"] var mongojs = require("mongojs"); var db =…
Arun Thampi
  • 41
  • 1
  • 6
3
votes
0 answers

If a multi update fails partially in mongodb, how to roll back?

I understand that a multi update will not be atomic and there are chances that the update query may fail during the process. The error can be found via getLastError. But what if I want to roll back the updates that have already been done in that…
Sudhanshu
  • 457
  • 5
  • 18
3
votes
1 answer

How can I update child objects in mongodb

I want to store objects like this with mongodb: { field: 'example', attr: { tmp : 'test', tmp1 : 'test1' } }; Now I would like to search for the entry which has the property field:'example' and add a field to its…
user2226834
  • 63
  • 1
  • 6
3
votes
2 answers

MongoDB and MongoJS - can't get runCommand to work for text queries

My goal is to use MongoDB's (2.4.4) text command from Node. It works fine from the command line. Based on this previous SO issue: Equivalent to mongo shell db.collection.runCommand() in Node.js, I tried using MongoJS (0.7.17) but can't make it go. …
michael
  • 241
  • 1
  • 5
  • 12
3
votes
3 answers

nodejs and mongodb (mongojs): Trying to query and update database within a for loop

I'm writing a multiplayer game(mongojs, nodejs) and trying to figure out how to update user stats based on the outcome of the game. I already have the code written to compute all the post game stats. The problem comes when I try to update the users'…
v3xx3d
  • 57
  • 6
3
votes
1 answer

dynamic collections with node.js and monogjs

i try to find a way to use vars for mongojs collections. The data are dynamic and also the db.VAR.find(); must be dynamic. Is there a solution for that problem. I searched here and google, but there is nothing. I hope you can help me. Example: var…
3
votes
2 answers

how to delete a record using mongojs

I am using mongojs together with nodejs and express. From so many online documents I only found find() save() update() methods. Is there a delete api ? If so, how to use it? I am trying to remove one record based on _id which is auto generated by…
Job Smith
  • 263
  • 1
  • 6
  • 15
2
votes
1 answer

How to insert my data into collection in a loop in mongoDB?

I want to populate data into a collection in mongo db. If I to hard-code the insert query, it would be as if: db.devices.insertMany([ {"_id" : "FX200FTQ2109BZ00", "cloud_blueprint_id" : 105969, "cloud_blueprint_name" : "AWS-BP" }, {"_id" :…
user3595231
  • 711
  • 12
  • 29
2
votes
1 answer

Node js throws MongoError: Cannot use a session that has ended while updating multiple documents in multiple collections

I am trying to update multiple documents in multiple collections in a DB. While doing that Mongo throws an error after the first collection. And doesn't make changes on the after ones. Error Assertion failed: MongoError: Cannot use a session that…
2
votes
3 answers

What are difference of mongoose and mongoJS ? Which should I use?

I just want to know, what are differences of mongoose and mongoJS. And, what the advantage and the lack if we use mongoose or mongoJS ? Because we know that are many depedency that use to connecting NodeJS and MongoDB. For example mongoose and…
2
votes
1 answer

Distinct in node fails using mongojs

Im quite new to node and mongodb, but im trying to write a simple API for a monitoring app. I can list out all aps fine through the /aps call, but /locations throws a: process.nextTick(function() { throw err; }); …
shakalakka
  • 105
  • 1
  • 1
  • 8
2
votes
0 answers

convert object stream to readable stream hapi

I am creating REST api with hapi and mongojs. I need to output large number of JSONs as API response. I am using following code. But getting error “Error: Stream must have a streams2 readable interface”. handler: function(request, reply) { …
Dev
  • 21
  • 2
2
votes
1 answer

Connect to Mongodb from Angular, from where?

I have this admin panel template that's built in nodejs, jquery and angular. I am trying to connect it to a mongodb to make simple CRUD operations. I've installed mongojs via npm for this purpose but how do I take it from here? The Datebase itself…
1 2
3
20 21