MongoDB noob here...  Ok, I have a collection of students, each with a record that looks like the following.... I want to sort the 'type' : 'homework' scores in descending order.  what does that incantation look like on the mongo sh...
I know that it is a bad practice to use skip in order to implement pagination, because when your data gets large skip starts to consume a lot of memory. One way to overcome this trouble is to use natural order by _id field:  //Page 1 db.users.find(...
It seems mongo does not allow insertion of keys with a dot (.) or dollar sign ($) however when I imported a JSON file that contained a dot in it using the mongoimport tool it worked fine. The driver is complaining about trying to insert that elemen...
I'm trying to select only a specific field with  exports.someValue = function(req, res, next) {     //query with mongoose     var query = dbSchemas.SomeValue.find({}).select('name');      query.exec(function (err, someValue) {         i...
FBFriendModel.find({     id: 333 }, function (err, docs) {     docs.remove(); //Remove all the documents that match! });   The above doesn't seem to work. The records are still there.   Can someone fix?...
To modify a field in an existing entry in mongoose, what is the difference between using  model = new Model([...]) model.field = 'new value'; model.save();   and this  Model.update({[...]}, {$set: {field: 'new value'});   The reason...
I'd like to use the MongoDB native JS driver with bluebird promises. How can I use Promise.promisifyAll() on this library?...
I have server.js and db.js The db.js file interacts with my database using Mongoose and I use server.js to call functions from db.js :  var mongoose = require('mongoose'); mongoose.connect('', { useNewUrlParser: true }) var Schema =...
I am getting the below error:  { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }    js-bson: Failed to load c++ bson extension, using pure JS version   Here are my version details:   OS: Windows 7 Mong...
I have the following simple shema:   var userSchema = new Schema({     name : String,    age: Number,    _creator: Schema.ObjectId   });    var User = mongoose.model('User',userSchema);   What I want to do is create the new document and ret...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.