Questions tagged [node-mongodb-native]

The MongoDB Native Node.js driver is an officially supported driver providing a native asynchronous Node.js interface to MongoDB. It can be used on its own, but it also serves as the basis of several object mapping libraries, such as Mongoose.

The MongoDB Native Node.js driver is an officially supported driver written in pure JavaScript to provide a native asynchronous Node.js interface to MongoDB. The driver is optimized for simplicity. It can be used on its own, but it also serves as the basis of several object mapping libraries, such as Mongoose ODM.

Installing/upgrading

The easiest way to install the driver is to use npm:

$ npm install mongodb

Documentation

3.0 Driver

2.2 Driver

Related links

482 questions
0
votes
1 answer

Correct way to connect to (a pool with) node-mongodb-native

With MongoDB, a suggestion was to always re-use the same database connection, and have a pool of connections to support some concurrency. In node-mongodb-native 1.x you could configure the db and server object, creating a pool like so: var server =…
Redsandro
  • 11,060
  • 13
  • 76
  • 106
0
votes
1 answer

Native node mongodb driver returns correct document but with empty Number array when created by Mongo-C

Please see edits at the bottom. This seems to be a Mongo-C and or native node-mongodb issue and not a Mongoose issue. I have a real time collection of seismic data stored in MongoDB. One key, called data, is an int array of samples. When I query…
0
votes
1 answer

Reconnection to the failed mongo server

I'm connecting to the mongo with reconnect options on the startup and using created db over the whole app. var options = { "server": { "auto_reconnect": true, "poolSize": 10, "socketOptions": { "keepAlive": 1 } …
smirnov
  • 413
  • 3
  • 9
0
votes
1 answer

How to find data of nearest location from mongodb collection using mongoose?

I am looking for list of nearest branch of branchId [Array], eg :[109,110,115] // My Schema var BranchSchema = new Schema({ branchId : { type : Schema.Types.ObjectId }, branchName : { type : String }, branchAddress : { Address:{ type :…
0
votes
0 answers

forEach insertion into MongoDb using Node.js / Bulk insertion using a template

I'm trying to bulk insert thousands of entries into Mongo, what I'm looking for is some sort of way to define a template and only change 1 / multiple variables in that document instead of sending thousands of huge documents that are actually the…
Eek
  • 1,740
  • 1
  • 15
  • 24
0
votes
1 answer

TypeError: Cannot read property 'collection' of undefined

I am new in nodejs and currently working on node.js and mongodb.This my mongodb connection code var mongodb = require("mongodb"); var MongoClient = mongodb.MongoClient; var url = 'mongodb://localhost:27017/mydb'; var mongodbStore = {}; var…
Abhay Kulkarni
  • 73
  • 1
  • 3
  • 5
0
votes
1 answer

Custom sorting in MongoDB

I am creating a NodeJS application and I want to sort contacts by last name. The problem is the name part must be saved as one string and when I use the sort function in MongoDB, the defaults are ascending or descending. Is it possible to create a…
Geoffry
  • 25
  • 3
0
votes
1 answer

How to store binary data (PNG) in MongoDB via Mongoose?

I'm working on a site with a MEAN stack scaffolded from this yeoman.io generator: https://github.com/DaftMonk/generator-angular-fullstack, and I'm trying to upload some image files to MongoDB in binary form. Here is my git repo for the…
0
votes
1 answer

MongoDB NodeJS driver, how to know when .update() 's are complete

As the code is quite large to posted in here, I append my github repo https://github.com/DiegoGallegos4/Mongo I am trying to use de NodeJS driver to update some records fulfilling a criteria but first I have to find some records fulfilling another…
Diego Gallegos
  • 1,722
  • 2
  • 18
  • 31
0
votes
1 answer

MongoDB update with $isolated

i want to know the difference between this 2 query: myCollection.update ( { a:1, b:1, $isolated:1 } ); myCollection.update ( { $and: [ {a:1}, {b:1}, {$isolated:1} ] }…
Daniele Tassone
  • 2,104
  • 2
  • 17
  • 25
0
votes
0 answers

save memory when updating billion records with mongodb

I have an collection with billion records. I need to update all records every 5 minutes. It will consume a lot of memory if I query all records then update every record by loop. Does mongoose/node-mongodb-native support to update every record one by…
Vo Thanh Thang
  • 330
  • 1
  • 5
  • 16
0
votes
0 answers

load balancing between multiple mongos instances in mongodb cluster

I have several mongos instances. I have ruby and node.js application. I can put the hosts of all the mongos instances to mongodb connection URI. The ruby and node.js drivers can handle the failover. But can the two drivers do balancing between the…
BAE
  • 8,550
  • 22
  • 88
  • 171
0
votes
0 answers

Issue with mongodb document limit

I am using mongodb 3.0.2 and when I run "top" command : > db.runCommand( { top: 1 } ) I got the following error message: 2015-06-01T16:36:52.886+0900 E QUERY Error: error: { "$err" : "BSONObj size: 46060490 (0x2BED3CA) is invalid. Size…
nthien
  • 1
0
votes
1 answer

Using Dynamic strings for querying nested mongo doc

I'm using the dot notation for querying a nested mongo doc. However I want this query to be dynamically generated. For eg The nesting is as { "Car": { "Make": { "Model": "Some val" Year : "Some year" …
sarath joseph
  • 2,533
  • 2
  • 20
  • 23
0
votes
1 answer

Node Mongoose and Q Promises

I'm trying to wrap my brain around promises and I'm refactoring some nested callbacks into promises. I'm encountering something I don't understand and any help anyone could provide would be appreciated. There's definitely something wrong with my…
Vic F
  • 1,143
  • 1
  • 11
  • 26