/** * Created by chaozhou on 2015/10/6. */ var mongoose = require("mongoose"); var db = mongoose.createConnection("127.0.0.1", "cms"); //链接错误监听 db.on("error", function (error) { console.log(error); }); //Schema结构 va…
mongodb操作文件,主要是通过GridFS类.存储文件主要存放在fs中,其中的fs是数据库默认的.并且GridFS是直接与数据库打交道,与collection集合无关. =============== https://docs.mongodb.com/manual/core/gridfs/ When to Use GridFS In MongoDB, use GridFS for storing files larger than 16 MB. =======================…
创建.删除数据库 格式 use DATABASE_NAME 如果不存在,则创建,否则直接切换到该数据库 显示当前所在的数据库 db 显示所有数据库 show dbs 删除数据库 db.dropDatabase() 例子 > show dbs admin .078GB db_log .953GB local .078GB test .078GB > use del_db switched to db del_db > db.col.insert({x:}) WriteResult({ })…
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding…