Do you have an existing dict and you need to insert it as a record, but also want the record id? In that case, you can do:
id = db.person.insert(**some_dict) Anthony On Thursday, August 23, 2012 3:30:44 AM UTC-4, puercoespin wrote: > > Hi > > if ""db.person.insert(name='Juan',age=23)"" is equal to > ""db.person[0] = dict(name='Juan',age=23)"" > > how to save the id of the new record in the second case? > > h=db.person.insert(name='Juan',age=23) saves the id in h but: > > h=db.person[0] = dict(name='Juan',age=23) saves the dict in h, not the id! > > I need to access to the id in the second case. > > thanks > > --

