Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7839459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:27:05+00:00 2026-06-02T15:27:05+00:00

I’m having trouble figuring out what this error means LEFT_SUBFIELD only supports Object: stats

  • 0

I’m having trouble figuring out what this error means

LEFT_SUBFIELD only supports Object: stats not: 6

It seems to be happening when I am inserting into my profiles collection. I am using mongoose.js. We are inserting counts of posts in each category in the stats property, e.g.

stats: {category:count, category2: count2}.

Here is my schema

var ProfileSchema = new Schema({
  uname: {
    type: String,
    required: true,
    index: true,
    unique: true
  },
  fname: String,
  lname: String,
  stats: {
    type:{},
    "default":{},
    required:true
  },
  created: {
    type:Date,
    required:true,
    "default":Date.now
  }
});

I think it might be happening when I am updating the stats object $inc counts so that stats can come out to something like this update

db.status.update({_id:xyz}, {$inc: { stats.foo : 1, stats.bar:1}})

Here’s my mongoose code

      var tags = ["comedy", "action", "drama"];

      //also adding the postId to the posts collection of profile
      var updateCommand = {$push: {posts: post._id}};

      var stats = {};
      for (var i = tags.length - 1; i >= 0; i--){
        stats["stats." + tags[i].toString()] = 1;
      };
      updateCommand.$inc = stats;

      Profile.update(
        {uname: uname}, 
        updateCommand,
        {safe:true, upsert:true},
        callback
      );
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T15:27:06+00:00Added an answer on June 2, 2026 at 3:27 pm

    You may be running into this:

    https://jira.mongodb.org/browse/SERVER-2651

    or

    https://jira.mongodb.org/browse/SERVER-5227

    Both of which are fixed in the 2.1 dev branch already but not (yet) backported to 2.0

    There is a decent discussion here about a similar issue:

    https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/VhjhcyEdbNQ

    Basically it boils down to the fact that you are likely passing an empty key as part of the update which needs to be avoided.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.