Skip to main content
Glama
05.Mongo插件.md1.44 kB
--- title: "Mongo插件" date: "2022-01-30T10:17:08.000Z" permalink: "/pages/plugin/mongo/" --- # 引入依赖 <dependency> <groupId>org.ssssssss</groupId> <artifactId>magic-api-plugin-mongo</artifactId> <version>magic-api-lastest-version</version> </dependency> # 配置 # 以下配置根据实际情况修改 spring: data: mongodb: host: localhost port: 27017 database: magciaapi username: magciaapi password: 123456 # 使用 import mongo; //导入mongodb模块 //插入多条数据 mongo.database('databaseName').collection('collectionName').insert([{key : value},{key : value}]); //插入单条数据 mongo.database('databaseName').collection('collectionName').insert({key : value}); //查询数据 mongo.database('databaseName').collection('collectionName').find({key : value}).skip(2).limit(1).list(); //修改数据 mongo.database('databaseName').collection('collectionName').update({key : oldValue},{key : newValue}); mongo.database('databaseName').collection('collectionName').updateMany({key : oldValue},{key : newValue}); //查询总数 mongo.database('databaseName').collection('collectionName').count({key : value}); mongo.database('databaseName').collection('collectionName').count(); //删除数据 mongo.database('databaseName').collection('collectionName').remove({key : value}); mongo.database('databaseName').collection('collectionName').removeOne({key : value});

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Dwsy/magic-api-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server