C # Development MONGO note Seventh

Source: Internet
Author: User

Development to meet some of the problems here, which is here to ask you

Today I finished the menu function,

  Public   classMenu { PublicObjectId _id {Get;Set; }  Public intMenuId {Get;Set; }  Public stringName {Get;Set; }  Public intParentID {Get;Set; }  Public stringURL {Get;Set; }  Public stringIcon {Get;Set; }  Public intOrderNo {Get;Set; }  Public stringDESCR {Get;Set; } }

The first is a menu that is done in the most general manner using the internal key. When I finished it suddenly occurred to me that since the Monogo structure is so loose, why don't I put the menu as a word Gencun into it, then add a field

   Public New List<menu> ();

stored in a database structure like this,

I thought everything was going well, but I realized that even the most basic function of inserting a submenu could not be achieved.

When I add a menu, I usually add a parent menu and then add a submenu to the parent menu, which is equivalent to modifying the child property of the document.

And then I'm going to write it in a modified way

                   parent. Child.add (menu);                     var queryid = Query.and (Query.eq ("MenuId", PID));                                      var update = Update.set ("child", menu);                             DAL. Dalmenu.update (Queryid, Update);

So here's the problem, Update.set () the second parameter of this function is bsonvalue type, I can't put a set as a parameter, the Update method must also specify a field to modify, and then I suddenly do not know how to modify.

Then I started Baidu (since Google highlighted China after I started Baidu), the results can be found are the basic additions and deletions to check, ah, quite helpless ah,

I hope I know how to do it.

C # Development MONGO note Seventh

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.