Sunday 15 August 2010

ruby on rails - Mongoid as_json causes document to delete -


While running the following query, Mongo DB raises the issue of a deleted command secretly and removes the object as such as_json was going on. The to_json has the same effect.

  stream.first.ass_assessment  

Mongogab log

  database = integration archive = Stream selector = {"$ query" = & gt; {}, "$ Orderby" = & gt; {: _ Id = & gt; 1}} Flags = [] Boundary = - 1 left = 0 batch_size = Zero fields = zero order: 62.9890ms Mopped: 54.237.57.2:10996 Delete database = integration collection = streams selector = {"_ id" => BSON :: ObjectId ('55087e6e436c611d42410000')} Flags = [: Remove_first]  

Environment

Rails 4.2, Moguid 4.0.2 and Mongodie 3.0.0

Stream Models

  Monoged in the class stream :: Document Field: stream_identifier, Type: String Field: Cover, Type: String Field: Caption, Type: String Field: Location, Type: String Field: Place, Type: String Field: watchers_count, Type: Integer Area: comments_count, Type: W Credential field: likes_count, type: integer area: restreams_count, type: integer field: activities, type: array area: impressive persons, type: array area: encores, type: string field: cover_images, type: array Region: Position, Type: String Field: end_time, Type: Integer Area: tweet_id, Type: String Field: Fans, Type: Array Area: Like, Type Type: string field: delete, then type: string field: playlist, type: string field: restreams, type: string field: comment, type: string field: watchers, type: string alias_attribute: likesCount : Likes_count alias_attribute: coverImages,: Cover_images alias_attribute: comments_count ,: comments_count alias_attribute: watchersCount ,: watchers_count alias_attribute: restreamsCount ,: restreams_count alias_attribute: endTime,: end_time alias_attribute: tweetId,: tweet_id embeds_one: broadcaster has_one: feed def update_stream UpdateStreamStatus.perform_async End (self.stream_identifier) Cloud Broadcast: Mongoid :: Document field: identifier, type: string field: name, type: string   

BroadcastModel field: display_name, type: String field: profile, type: string field: image, type: string alias_attribute: DISPLAYNAME ,: display_name embedded_in: section end

Your stream has a field named delete :

  field: delete, type: your model ( Each field in the  m ) ( f ) will call  as_json  and  

string

code> to_json for mf . This means that calling every as_json or to_json will end the call m.delete . It is possible that the call for Mongoid destroys the method and removes the document from MongoDB that (without calling callback) method.

I recommend changing your name to the area to do something that does not conflict with the modode methods.


No comments:

Post a Comment