Questions tagged [mongojs]

MongoJS is a Node.js package to access MongoDB.

References:

306 questions
0
votes
0 answers

How to retrieve and display data from mongodb using node.js

JSON: "name" : "fhj", "age" : "23", "gender" : "female", "sec" : "b", "username" : "9886666", "language" : "HINDI", "method" : "method2", "timeSlot" : { "id" : 2, "fromTime" : 12, "toTime" : 15 } I use mongoJS for database…
Subham
  • 1,414
  • 4
  • 17
  • 34
0
votes
3 answers

Fields ordering using find() in mongodb

All! My document has such structure: { fname: value, lname: value, city: value } When I use find() method, I get result in default order fname, lname, city. But I want to get result in other order of field, such as: city, fname,…
0
votes
1 answer

mongodb TTL doesn't work on collection property - mongojs

I'm using mongojs to interact with mongodb in my app. I need to add TTL support for the collection making the documents delete themselves every hour. Here's how I'm creating index on app start: db.collection.ensureIndex({'createdAt': 1,…
Kosmetika
  • 20,774
  • 37
  • 108
  • 172
0
votes
1 answer

How to change a certain fields name in all my documents with mongojs?

I have a collection, in this collection all my records have, for example, a field named "car". I get a new name for this field from my form and i would like to go through all my records and change only the fields name, without changing the value. I…
0
votes
1 answer

MongoDB ObjectID in JS

I am trying to make pagination work with MongoDB without skip(); In mongo shell I got the following results with my query, but in Javascript a empty []; I think I am doing the ObjectID wrong, I use the "mongodb ObjectID" and "mongojs" libs with…
Jeroen Steen
  • 531
  • 8
  • 22
0
votes
1 answer

Using MongoJs and Node.JS to store data

I have successfully connected to MongoDb and used a form to send some data. I would now like to store the data in a json document with a collection. So my current output is: { "_id": "53be957007d2c838083046a6", "subscriberinfo": "X", …
user3821263
  • 121
  • 1
  • 8
0
votes
3 answers

Pushing new value to array in MongoDB document with NodeJS

I have a MongoDB collection with documents that look as follows: { "id": 51584, "tracks": [], "_id": { "$oid": "ab5a7... some id ...cc81da0" } } I want to push a single track into the array, so I try the following NodeJS…
appel
  • 517
  • 2
  • 7
  • 19
0
votes
1 answer

Mongojs update dynamic generator $set

I'm trying to dynamically generate the $set values to update a users account details in the database. I'm using mongojs. Here is a portion of the code. var updateData = ''; if(data.avatar_url) { updateData += "avatar_url: \"" +…
Zander17
  • 1,894
  • 5
  • 23
  • 31
0
votes
1 answer

MongoDB incomplete search

I'm new to MongoDB but here goes: Is there a way to do a form of partial search in MongoDB? For example, if the document is something like { Name: Michael A. Johnson}, is there a way to format search so that it will return that document for a query…
techalicious
  • 443
  • 1
  • 6
  • 14
0
votes
2 answers

NodeJS can't save/insert content via MongoJS

Iam trying to save/insert in MongoDB using express and mongoJS My Code : var port = 8580; var express = require ('express'); var app = express (); // import mongojs Modul var mongojs = require("mongojs"); //connect var db =…
user1175380
  • 87
  • 2
  • 10
0
votes
1 answer

Incremental UnorderedBulkOp calls to 'execute' are exponentially slower

I am trying to write a custom bulk upload script using the new mongo bulk apis. I am using UnorderedBulkOp which works really fast initially, but after being called several times it begins to hang. I've tried using log lines and it seems that after…
Comart
  • 64
  • 2
  • 8
0
votes
1 answer

MongoJS Node.js modules:"db is not undefined"

I'm new to Node.js, MongoDB and MongoJS. I have app.js which is the server I run from my command line with node app.js. On a local machine with OS X 10.9.1 with Node.js v0.10.28. In app.js I have (as snippets) var db = require('./database'); var…
Jared
  • 2,978
  • 4
  • 26
  • 45
0
votes
3 answers

How to parse Android JSONArray made of Android JSONObjects in JavaScript?

I have an Android Application and a Server with Node.js that uses Restify.js and MongoJS to store data from and to my android application. For now, I am using JSONArray from Android (but in my case, it's json-simple lib based on original lib) and I…
Mackovich
  • 3,319
  • 6
  • 35
  • 73
0
votes
2 answers

Add extra fields dependent of other query to query result in mongodb, using mongojs

I need to make a MongoDB query and add an extra field to each one of my results. The field values depend of the result of another query. I'm trying to call the nested query in my server.js code. It's not working because res.json(data) is called…
Amaury Medeiros
  • 2,093
  • 4
  • 26
  • 42
0
votes
1 answer

Querying multiple collections in MongoDB scoping issue

I'm trying to query two separate collections using MongoJS (node.js mongodb wrapper) to build an array of objects that I'll then render with my view using EJS. The issue I've run into seems to do with scoping. function getTeamMembers(projectID){ …
AJB
  • 7,389
  • 14
  • 57
  • 88