{"id":1120,"date":"2025-07-07T14:18:41","date_gmt":"2025-07-07T06:18:41","guid":{"rendered":"https:\/\/beijian99.top\/?p=1120"},"modified":"2025-07-07T14:19:49","modified_gmt":"2025-07-07T06:19:49","slug":"mongodb","status":"publish","type":"post","link":"https:\/\/beijian99.top\/?p=1120","title":{"rendered":"MongoDB"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u5f15\u8a00<\/h2>\n\n\n\n<p>\u5728\u5f53\u4eca\u6570\u636e\u9a71\u52a8\u7684\u4e16\u754c\u4e2d\uff0cNoSQL \u6570\u636e\u5e93\u56e0\u5176\u7075\u6d3b\u6027\u548c\u53ef\u6269\u5c55\u6027\u800c\u5e7f\u53d7\u6b22\u8fce\u3002MongoDB \u4f5c\u4e3a\u9886\u5148\u7684\u6587\u6863\u578b\u6570\u636e\u5e93\uff0c\u4e0e\u4f20\u7edf\u5173\u7cfb\u578b\u6570\u636e\u5e93\u76f8\u6bd4\uff0c\u63d0\u4f9b\u4e86\u66f4\u81ea\u7136\u7684\u6570\u636e\u5efa\u6a21\u65b9\u5f0f\u3002\u672c\u6587\u5c06\u63a2\u8ba8 MongoDB \u7684\u6838\u5fc3\u6982\u5ff5\uff0c\u5e76\u901a\u8fc7 Go \u8bed\u8a00\u793a\u4f8b\u5c55\u793a\u5982\u4f55\u9ad8\u6548\u5730\u4f7f\u7528 MongoDB \u8fdb\u884c\u5f00\u53d1\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"224\" height=\"224\" src=\"https:\/\/beijian99.top\/wp-content\/uploads\/2025\/07\/image-7.png\" alt=\"\" class=\"wp-image-1123\" srcset=\"https:\/\/beijian99.top\/wp-content\/uploads\/2025\/07\/image-7.png 224w, https:\/\/beijian99.top\/wp-content\/uploads\/2025\/07\/image-7-150x150.png 150w\" sizes=\"auto, (max-width: 224px) 100vw, 224px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\u3001MongoDB \u6838\u5fc3\u4f18\u52bf<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u200b<strong>\u200b\u6587\u6863\u578b\u6570\u636e\u6a21\u578b\u200b<\/strong>\u200b\uff1a\n<ul class=\"wp-block-list\">\n<li>\u6570\u636e\u4ee5 BSON (Binary JSON) \u683c\u5f0f\u5b58\u50a8<\/li>\n\n\n\n<li>\u5d4c\u5957\u6587\u6863\u51cf\u5c11\u590d\u6742\u5173\u8054\u67e5\u8be2<\/li>\n\n\n\n<li>\u52a8\u6001\u6a21\u5f0f\u9002\u5e94\u5feb\u901f\u53d8\u5316\u7684\u4e1a\u52a1\u9700\u6c42<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u200b<strong>\u200b\u6c34\u5e73\u6269\u5c55\u80fd\u529b\u200b<\/strong>\u200b\uff1a\n<ul class=\"wp-block-list\">\n<li>\u5206\u7247(Sharding)\u5b9e\u73b0\u6d77\u91cf\u6570\u636e\u5b58\u50a8<\/li>\n\n\n\n<li>\u526f\u672c\u96c6(Replica Set)\u4fdd\u969c\u9ad8\u53ef\u7528\u6027<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u200b<strong>\u200b\u4e30\u5bcc\u7684\u67e5\u8be2\u80fd\u529b\u200b<\/strong>\u200b\uff1a\n<ul class=\"wp-block-list\">\n<li>\u652f\u6301\u7d22\u5f15\u3001\u805a\u5408\u7ba1\u9053<\/li>\n\n\n\n<li>\u5730\u7406\u7a7a\u95f4\u67e5\u8be2<\/li>\n\n\n\n<li>\u5168\u6587\u68c0\u7d22<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001Go \u8bed\u8a00\u9a71\u52a8\u5b89\u88c5<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ngo get go.mongodb.org\/mongo-driver\/mongo\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u4e09\u3001\u57fa\u7840\u64cd\u4f5c\u793a\u4f8b<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u8fde\u63a5 MongoDB<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\npackage main\n\nimport (\n\t&quot;context&quot;\n\t&quot;fmt&quot;\n\t&quot;log&quot;\n\t&quot;time&quot;\n\n\t&quot;go.mongodb.org\/mongo-driver\/mongo&quot;\n\t&quot;go.mongodb.org\/mongo-driver\/mongo\/options&quot;\n)\n\nfunc connectMongoDB(uri string) (*mongo.Client, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\t\n\tclient, err := mongo.Connect(ctx, options.Client().ApplyURI(uri))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t\n\t\/\/ \u68c0\u67e5\u8fde\u63a5\n\terr = client.Ping(ctx, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t\n\treturn client, nil\n}\n\nfunc main() {\n\tclient, err := connectMongoDB(&quot;mongodb:\/\/localhost:27017&quot;)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer client.Disconnect(context.Background())\n\t\n\tfmt.Println(&quot;\u6210\u529f\u8fde\u63a5\u5230MongoDB!&quot;)\n}\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">2. \u6570\u636e\u6a21\u578b\u5b9a\u4e49<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\ntype Product struct {\n\tID          primitive.ObjectID `bson:&quot;_id,omitempty&quot;`\n\tName        string             `bson:&quot;name&quot;`\n\tPrice       float64            `bson:&quot;price&quot;`\n\tCategories  &#x5B;]string           `bson:&quot;categories,omitempty&quot;`\n\tInventory   Inventory          `bson:&quot;inventory,omitempty&quot;`\n\tCreatedAt   time.Time          `bson:&quot;created_at&quot;`\n\tLastUpdated time.Time          `bson:&quot;last_updated,omitempty&quot;`\n}\n\ntype Inventory struct {\n\tStock     int       `bson:&quot;stock&quot;`\n\tWarehouse string    `bson:&quot;warehouse&quot;`\n\tUpdatedAt time.Time `bson:&quot;updated_at&quot;`\n}\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">3. CRUD \u64cd\u4f5c<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">\u521b\u5efa\u6587\u6863<\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\nfunc createProduct(collection *mongo.Collection, product Product) (*mongo.InsertOneResult, error) {\n\tproduct.CreatedAt = time.Now()\n\tresult, err := collection.InsertOne(context.Background(), product)\n\treturn result, err\n}\n<\/pre><\/div>\n\n\n<h4 class=\"wp-block-heading\">\u67e5\u8be2\u6587\u6863<\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\nfunc getProductByName(collection *mongo.Collection, name string) (*Product, error) {\n\tvar product Product\n\tfilter := bson.M{&quot;name&quot;: name}\n\terr := collection.FindOne(context.Background(), filter).Decode(&amp;product)\n\treturn &amp;product, err\n}\n<\/pre><\/div>\n\n\n<h4 class=\"wp-block-heading\">\u66f4\u65b0\u6587\u6863<\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\nfunc updateProductPrice(collection *mongo.Collection, name string, newPrice float64) (*mongo.UpdateResult, error) {\n\tfilter := bson.M{&quot;name&quot;: name}\n\tupdate := bson.M{\n\t\t&quot;$set&quot;: bson.M{\n\t\t\t&quot;price&quot;:        newPrice,\n\t\t\t&quot;last_updated&quot;: time.Now(),\n\t\t},\n\t}\n\tresult, err := collection.UpdateOne(context.Background(), filter, update)\n\treturn result, err\n}\n<\/pre><\/div>\n\n\n<h4 class=\"wp-block-heading\">\u5220\u9664\u6587\u6863<\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\nfunc deleteProduct(collection *mongo.Collection, name string) (*mongo.DeleteResult, error) {\n\tfilter := bson.M{&quot;name&quot;: name}\n\tresult, err := collection.DeleteOne(context.Background(), filter)\n\treturn result, err\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u56db\u3001\u9ad8\u7ea7\u7279\u6027\u5b9e\u8df5<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u4e8b\u52a1\u5904\u7406<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\nfunc transferStock(client *mongo.Client, from, to string, amount int) error {\n\tsession, err := client.StartSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer session.EndSession(context.Background())\n\t\n\t_, err = session.WithTransaction(context.Background(), func(ctx mongo.SessionContext) (interface{}, error) {\n\t\tcollection := client.Database(&quot;shop&quot;).Collection(&quot;products&quot;)\n\t\t\n\t\t\/\/ \u51cf\u5c11\u6e90\u4ed3\u5e93\u5e93\u5b58\n\t\tfilter := bson.M{&quot;inventory.warehouse&quot;: from}\n\t\tupdate := bson.M{&quot;$inc&quot;: bson.M{&quot;inventory.stock&quot;: -amount}}\n\t\tif _, err := collection.UpdateMany(ctx, filter, update); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t\n\t\t\/\/ \u589e\u52a0\u76ee\u6807\u4ed3\u5e93\u5e93\u5b58\n\t\tfilter = bson.M{&quot;inventory.warehouse&quot;: to}\n\t\tupdate = bson.M{&quot;$inc&quot;: bson.M{&quot;inventory.stock&quot;: amount}}\n\t\tif _, err := collection.UpdateMany(ctx, filter, update); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t\n\t\treturn nil, nil\n\t})\n\t\n\treturn err\n}\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">2. \u805a\u5408\u7ba1\u9053<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\nfunc getCategoryStats(collection *mongo.Collection) (&#x5B;]bson.M, error) {\n\tpipeline := mongo.Pipeline{\n\t\t{{&quot;$unwind&quot;, &quot;$categories&quot;}},\n\t\t{{&quot;$group&quot;, bson.D{\n\t\t\t{&quot;_id&quot;, &quot;$categories&quot;},\n\t\t\t{&quot;totalProducts&quot;, bson.D{{&quot;$sum&quot;, 1}}},\n\t\t\t{&quot;averagePrice&quot;, bson.D{{&quot;$avg&quot;, &quot;$price&quot;}}},\n\t\t\t{&quot;totalStock&quot;, bson.D{{&quot;$sum&quot;, &quot;$inventory.stock&quot;}}},\n\t\t}}},\n\t\t{{&quot;$sort&quot;, bson.D{{&quot;totalProducts&quot;, -1}}}},\n\t}\n\t\n\tcur, err := collection.Aggregate(context.Background(), pipeline)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer cur.Close(context.Background())\n\t\n\tvar results &#x5B;]bson.M\n\tif err = cur.All(context.Background(), &amp;results); err != nil {\n\t\treturn nil, err\n\t}\n\t\n\treturn results, nil\n}\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">3. \u7d22\u5f15\u7ba1\u7406<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\nfunc ensureIndexes(collection *mongo.Collection) error {\n\tindexModels := &#x5B;]mongo.IndexModel{\n\t\t{\n\t\t\tKeys: bson.D{{&quot;name&quot;, 1}},\n\t\t\tOptions: options.Index().\n\t\t\t\tSetUnique(true).\n\t\t\t\tSetCollation(&amp;options.Collation{\n\t\t\t\t\tLocale:   &quot;en&quot;,\n\t\t\t\t\tStrength: 2,\n\t\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tKeys: bson.D{{&quot;categories&quot;, 1}},\n\t\t},\n\t\t{\n\t\t\tKeys: bson.D{{&quot;price&quot;, 1}},\n\t\t},\n\t\t{\n\t\t\tKeys: bson.D{{&quot;inventory.warehouse&quot;, 1}, {&quot;inventory.stock&quot;, 1}},\n\t\t},\n\t}\n\t\n\t_, err := collection.Indexes().CreateMany(context.Background(), indexModels)\n\treturn err\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u4e94\u3001\u6027\u80fd\u4f18\u5316\u5efa\u8bae<\/h2>\n\n\n\n<p>\u200b<strong>\u200b<\/strong>\u200b<strong>\u200b1.\u67e5\u8be2\u4f18\u5316\u200b<\/strong>\u200b\uff1a<\/p>\n\n\n\n<p>\u4f7f\u7528&nbsp;<code>Projection<\/code>&nbsp;\u53ea\u8fd4\u56de\u5fc5\u8981\u5b57\u6bb5<\/p>\n\n\n\n<p>\u5408\u7406\u4f7f\u7528\u7d22\u5f15\uff0c\u907f\u514d\u5168\u96c6\u5408\u626b\u63cf<\/p>\n\n\n\n<p>\u4f7f\u7528&nbsp;<code>Explain()<\/code>&nbsp;\u5206\u6790\u67e5\u8be2\u6267\u884c\u8ba1\u5212<\/p>\n\n\n\n<p>\u200b<strong>\u200b2.\u6279\u91cf\u64cd\u4f5c\u200b<\/strong>\u200b\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\nfunc bulkInsertProducts(collection *mongo.Collection, products &#x5B;]Product) (*mongo.BulkWriteResult, error) {\n\tvar models &#x5B;]mongo.WriteModel\n\tfor _, p := range products {\n\t\tp.CreatedAt = time.Now()\n\t\tmodels = append(models, mongo.NewInsertOneModel().SetDocument(p))\n\t}\n\treturn collection.BulkWrite(context.Background(), models)\n}\n<\/pre><\/div>\n\n\n<p>\u200b<strong>\u200b3.\u8fde\u63a5\u6c60\u914d\u7f6e\u200b<\/strong>\u200b\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\nfunc getClientWithPool() (*mongo.Client, error) {\n\topts := options.Client().ApplyURI(&quot;mongodb:\/\/localhost:27017&quot;).\n\t\tSetMaxPoolSize(50).\n\t\tSetMinPoolSize(10).\n\t\tSetMaxConnIdleTime(30 * time.Second)\n\treturn mongo.Connect(context.Background(), opts)\n}\n\n<\/pre><\/div>\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u516d\u3001\u5b9e\u9645\u5e94\u7528\u6848\u4f8b\uff1a\u7535\u5546\u5e93\u5b58\u7cfb\u7edf<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: go; title: ; notranslate\" title=\"\">\ntype InventoryService struct {\n\tclient     *mongo.Client\n\tdatabase   string\n\tcollection string\n}\n\nfunc NewInventoryService(uri, db, coll string) (*InventoryService, error) {\n\tclient, err := connectMongoDB(uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &amp;InventoryService{\n\t\tclient:     client,\n\t\tdatabase:   db,\n\t\tcollection: coll,\n\t}, nil\n}\n\nfunc (s *InventoryService) ReserveProduct(productID primitive.ObjectID, quantity int) error {\n\tfilter := bson.M{\n\t\t&quot;_id&quot;:               productID,\n\t\t&quot;inventory.stock&quot;:   bson.M{&quot;$gte&quot;: quantity},\n\t}\n\tupdate := bson.M{\n\t\t&quot;$inc&quot;: bson.M{\n\t\t\t&quot;inventory.stock&quot;: -quantity,\n\t\t},\n\t\t&quot;$set&quot;: bson.M{\n\t\t\t&quot;last_updated&quot;: time.Now(),\n\t\t},\n\t}\n\t\n\tcollection := s.client.Database(s.database).Collection(s.collection)\n\tresult, err := collection.UpdateOne(context.Background(), filter, update)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif result.MatchedCount == 0 {\n\t\treturn fmt.Errorf(&quot;\u5e93\u5b58\u4e0d\u8db3\u6216\u4ea7\u54c1\u4e0d\u5b58\u5728&quot;)\n\t}\n\treturn nil\n}\n\nfunc (s *InventoryService) GetLowStockProducts(threshold int) (&#x5B;]Product, error) {\n\tfilter := bson.M{\n\t\t&quot;inventory.stock&quot;: bson.M{&quot;$lt&quot;: threshold},\n\t}\n\topts := options.Find().\n\t\tSetSort(bson.D{{&quot;inventory.stock&quot;, 1}}).\n\t\tSetLimit(100)\n\t\n\tcollection := s.client.Database(s.database).Collection(s.collection)\n\tcur, err := collection.Find(context.Background(), filter, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer cur.Close(context.Background())\n\t\n\tvar products &#x5B;]Product\n\tif err := cur.All(context.Background(), &amp;products); err != nil {\n\t\treturn nil, err\n\t}\n\treturn products, nil\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u4e03\u3001\u603b\u7ed3<\/h2>\n\n\n\n<p>MongoDB \u4e0e Go \u8bed\u8a00\u7684\u7ed3\u5408\u4e3a\u73b0\u4ee3\u5e94\u7528\u5f00\u53d1\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u6570\u636e\u5b58\u50a8\u548c\u5904\u7406\u80fd\u529b<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go \u7684 MongoDB \u9a71\u52a8\u63d0\u4f9b\u4e86\u7b80\u6d01\u800c\u5f3a\u5927\u7684 API<\/li>\n\n\n\n<li>\u6587\u6863\u578b\u6570\u636e\u6a21\u578b\u80fd\u66f4\u81ea\u7136\u5730\u6620\u5c04\u4e1a\u52a1\u5bf9\u8c61<\/li>\n\n\n\n<li>\u4e8b\u52a1\u548c\u805a\u5408\u7b49\u9ad8\u7ea7\u7279\u6027\u652f\u6301\u590d\u6742\u4e1a\u52a1\u573a\u666f<\/li>\n\n\n\n<li>\u5408\u7406\u7684\u7d22\u5f15\u548c\u67e5\u8be2\u4f18\u5316\u80fd\u663e\u8457\u63d0\u5347\u6027\u80fd<\/li>\n<\/ol>\n\n\n\n<p>\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u5efa\u8bae\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6839\u636e\u4e1a\u52a1\u9700\u6c42\u8bbe\u8ba1\u6587\u6863\u7ed3\u6784<\/li>\n\n\n\n<li>\u4e3a\u5173\u952e\u67e5\u8be2\u521b\u5efa\u9002\u5f53\u7d22\u5f15<\/li>\n\n\n\n<li>\u4f7f\u7528\u8fde\u63a5\u6c60\u7ba1\u7406\u6570\u636e\u5e93\u8fde\u63a5<\/li>\n\n\n\n<li>\u5b9e\u73b0\u9002\u5f53\u7684\u9519\u8bef\u5904\u7406\u548c\u91cd\u8bd5\u903b\u8f91<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5f15\u8a00 \u5728\u5f53\u4eca\u6570\u636e\u9a71\u52a8\u7684\u4e16\u754c\u4e2d\uff0cNoSQL \u6570\u636e\u5e93\u56e0\u5176\u7075\u6d3b\u6027\u548c\u53ef\u6269\u5c55\u6027\u800c\u5e7f\u53d7\u6b22\u8fce\u3002MongoDB \u4f5c\u4e3a\u9886\u5148\u7684\u6587\u6863 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1123,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[131],"tags":[160],"class_list":["post-1120","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-131","tag-mongo"],"_links":{"self":[{"href":"https:\/\/beijian99.top\/index.php?rest_route=\/wp\/v2\/posts\/1120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/beijian99.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/beijian99.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/beijian99.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/beijian99.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1120"}],"version-history":[{"count":2,"href":"https:\/\/beijian99.top\/index.php?rest_route=\/wp\/v2\/posts\/1120\/revisions"}],"predecessor-version":[{"id":1124,"href":"https:\/\/beijian99.top\/index.php?rest_route=\/wp\/v2\/posts\/1120\/revisions\/1124"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/beijian99.top\/index.php?rest_route=\/wp\/v2\/media\/1123"}],"wp:attachment":[{"href":"https:\/\/beijian99.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/beijian99.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/beijian99.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}