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(...
Doc:  {    _id: 5150a1199fac0e6910000002,    name: 'some name,    items: [{       id: 23,       name: 'item name 23'    },{       id: 24,       name: 'item name 24'    }] }   Is there a way to pull a specific object from an arra...
I have a basic node.js app that I am trying to get off the ground using Express framework.  I have a views folder where I have an index.html file.  But I receive the following error when loading the web browser.     Error: Cannot find module 'h...
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...
Is it possible for 2 Meteor.Collections to be retrieving data from 2 different mongdb database servers?  Dogs = Meteor.Collection('dogs')        // mongodb://192.168.1.123:27017/dogs Cats = Meteor.Collection('cats')        // mongod...
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'm trying to dynamically create _id's for my Mongoose models by counting the documents in the db, and using that number to create the _id (assuming the first _id is 0). However, I can't get the _id to set from my values. Here's my...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.