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 6531811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:55:23+00:00 2026-05-25T09:55:23+00:00

I have an object like follows: @connection.register class User(Document): __collection__ = ‘users’ __database__ =

  • 0

I have an object like follows:

@connection.register
class User(Document):
    __collection__ = 'users'
    __database__ = 'crucible_projects'
    use_schemaless = True
    structure = {
        'name': unicode,
        'password': unicode,
        'last_name': unicode,
        'first_name': unicode,
        'email': unicode,
        'last_login': datetime.datetime,
    }
    use_dot_notation = True
    def __repr__(self):
        return '<User %r>' % (self.name)

I have a user already in the database entered by hand that does not have the first_name and last_name field. Problem is when i try to run this

def login_user(user):
    found_attribute = connection.User.find_one({'name':user})
    found_attribute.last_login = datetime.datetime.utcnow()
    found_attribute.save()

I get this

>>> import db_users
>>> db_users.login_user('admin')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "db_users.py", line 91, in login_user
  found_attribute.save()
File "c:\Python27\lib\site-packages\mongokit-0.7-py2.7.egg\mongokit\document.py", line 394, in save
  self.validate(auto_migrate=False)
File "c:\Python27\lib\site-packages\mongokit-0.7-py2.7.egg\mongokit\document.py", line 243, in validate
  super(Document, self).validate()
File "c:\Python27\lib\site-packages\mongokit-0.7-py2.7.egg\mongokit\schema_document.py", line 353, in validate
  self._validate_doc(self, self.structure)
File "c:\Python27\lib\site-packages\mongokit-0.7-py2.7.egg\mongokit\schema_document.py", line 569, in _validate_doc
  "missed fields : %s" % struct_doc_diff )
File "c:\Python27\lib\site-packages\mongokit-0.7-py2.7.egg\mongokit\schema_document.py", line 524, in _raise_exception

raise exception(message)
mongokit.schema_document.StructureError: missed fields : ['first_name', 'last_name']

I would like to have some objects that dont have all the fields in the structure. What am I doing wrong?

Added an answer.

  • 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-05-25T09:55:24+00:00Added an answer on May 25, 2026 at 9:55 am

    It was a bug. Fixed in v0.7.1

    Changelog :
    
    * change MongokitMasterSlaveConnection to MasterSlaveConnection for consistency
    * fix #57 -- support pymongo > 1.9 in grid.py
    * fix #45 -- remove automatique index creation
    * fix #43 -- slicing a cursor should return a mongokit document, not dict
    * Dont try to convert None struct to json (patch from @mLewisLogic thanks !)
    * fix schemaless issue (thanks to Mihai Pocorschi for reporting it)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a struct defined like follows as part of an object. I'm trying
I'm just wondering .. I have and object like this public class Entry{ public
I have a script which creates a user-defined object like this: obj = new
I have an object that in a simplified form is as follows: public class
I have an on object like so var obj = {}; function set() {
if I have an XML object like this: <a> <u date=2009-04-10 value=543/> <u date=2009-04-11
I have an Object CaseNote which has numerous child object's like CaseNoteContactType . For
I have a LINQ query that returns some object like this... var query =
I have an object tree that looks something like Ball / \ LegalBall IllegalBall
I have an object for which I'd like to track the number of threads

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.