简体   繁体   中英

How to mutate a ndb repeated property?

The appengine docu says on repeated ndb properiertes, that:

When updating a repeated property, you can either assign it a new list or mutate the existing list in place.

https://developers.google.com/appengine/docs/python/ndb/properties#repeated

Two questions:

  1. do I save write operations when I just mutate the list, instead of putting a new list in place?

  2. how do I do exactly the mutation? just append the object and delete items within the list as I would do it with a list in python?

Thanks!

Yes you have it correct in your mind.

  1. No you don't save because it's still a write operations with the applied costs.
  2. Yes exactly like that. Appending like a normal list, deleting, etc etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM