¸ù°í ´ÑMongoDB ÀÛ¾÷À»À§ÇÑ Python ¹®¼ - °³Ã¼ ¸ÊÆÛ | |
Áö±Ý ´Ù¿î·Îµå |
¸ù°í ´Ñ ¼øÀ§ ¹× ¿ä¾à
±¤°í
- ƯÇã:
- MIT/X Consortium Lic...
- °¡°Ý:
- FREE
- °Ô½ÃÀÚ À̸§:
- Harry Marr
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://hmarr.com/
¸ù°í ´Ñ ű×
¸ù°í ´Ñ ¼³¸í
MongoDB ÀÛ¾÷À»À§ÇÑ Python ¹®¼ °³Ã¼ ¸ÅÆÛ MongoEngineÀº MongoDB¿Í Çù·ÂÇϱâÀ§ÇÑ Python Object-Document MapperÀÔ´Ï´Ù. http://hmarr.com/mongoengine/¿¡¼ »ç¿ëÇÒ ¼öÀÖ´Â ¹®¼ - ÇöÀç ÀÚ½À¼, »ç¿ëÀÚ °¡ÀÌµå ¹× API Reference.installationÀÌ ÀÖ½À´Ï´Ù. SetupTools°¡ÀÖ´Â °æ¿ì EASY_INSTALL MongoEngineÀ» »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. ±×·¸Áö ¾ÊÀ¸¸é GitHub¿¡¼ ¼Ò½º¸¦ ´Ù¿î·ÎµåÇÏ¿© Python Setup.py Install.Examples : ¸ù°í Á¨ÀÌ ÄÚµå (¹®¼)ÀÇ °£´ÜÇÑ ¿¹ : class blogpost (¹®¼) : title = stringfield (Çʼö = true, max_length = 200) °Ô½Ã µÊ = datetimefield (default = dateTime.dateTime.now) tags = listfield (blogpost) : content = stringfield (Çʼö = true) Ŭ·¡½º ¸µÅ© Æ÷½ºÆ® (blogPost) : url = stringfield (Çʼö = true) # »ý¼º ÅؽºÆ® ±â¹Ý °Ô½Ã¹° >>> Post1 = TextPost (title = 'mongoengine', content = 'Æ©Å丮¾ó ÂüÁ¶) >>> post1.tags = >>> post1.save ( ) # ¸µÅ© ±â¹Ý °Ô½Ã¹° ¸¸µé±â >>> Post2 = LinkPost (title = 'mongoengine docs', url = 'hmarr.com / mongoengine') >>> post2.tags = >> > post2.save () # blogPost.Objects¿¡¼ °Ô½Ã¹°¿¡ ´ëÇÑ BlogPost superclass >>>¸¦ »ç¿ëÇÏ¿© ¸ðµç °Ô½Ã¹°À» ¹Ýº¹ÇÕ´Ï´Ù. ... Àμâ '===', post.title, '==='... iSInstance ( Post, TextPost) : ... Àμâ Post.Content ... Elif IsInstance (Post, LinkPost) : ... Àμâ '¸µÅ© :' , post.url ... print ... === mongoengine »ç¿ë === ÀÚ½À¼º¸±â === mongoengine docs === ¸µÅ© : hmarr.com/mongoengine >>> len (blogpost.objects) 2 >>> len (htmlpost.objects) 1 >>> len (linkpost.objects) 1 # űװ¡ ÁöÁ¤µÈ °Ô½Ã¹° ã±â >>> len (blogpost.objects (tags = 'mongoengine')) 2 >>> len (blogpost.objects (tags = ' mongodb ')) 1 ¿ä±¸ »çÇ× : ¡¤ ÆÄÀ̽㠡¤ Pymongo. ¡¤ ½ºÇÎÅ©½º
¸ù°í ´Ñ °ü·Ã ¼ÒÇÁÆ®¿þ¾î