guanxf -凯发k8网页登录

我的博客:http://blog.sina.com.cn/17learning

  凯发k8网页登录-凯发天生赢家一触即发官网 :: 凯发k8网页登录首页 ::  ::  ::  ::  ::
  71 随笔 :: 1 文章 :: 41 评论 :: 0 trackbacks

2020年9月7日


createtree(1, orgnodetree, sameorgnodes, 0);


@noargsconstructor
@allargsconstructor
@getter
@setter
public class nodetree {
private string pname;
private string name;
private int level;
private list children;
}

private void createtree(int leave, int ind, map pindexnodenamemap, list childnodes) {
map cindexnodenamemap = new hashmap();
//构建树
int treeno = pindexnodenamemap.size();
if (treeno == 0) {
return;
}
int group = 0;
for (int i = ind; i < childnodes.size(); i ) {
nodevo node = childnodes.get(i);
long index = node.getid() % treeno;
nodetree pnode = pindexnodenamemap.get(index "");
list children = pnode.getchildren();
if (collectionutils.isempty(children)) {
children = new arraylist();
}
if (children.size() > 2) {
leave ;
createtree(leave, i, cindexnodenamemap, childnodes);
break;
} else {
nodetree child = new nodetree();
child.setlevel(leave);
child.setpname(pnode.getname());
child.setname(node.getnodename());
children.add(child);
pnode.setchildren(children);
cindexnodenamemap.put(group "", child);
group ;
}
}
}


private boolean createtree(int level, list parentnodes, list childnodes, int beginindex) {
//构建树
list nextlevelnodes = new arraylist<>();
for (int i = beginindex; i < childnodes.size(); i ) {
int parentcount = 1;
for (nodetree pnode : parentnodes) {
list children = pnode.getchildren();
if (collectionutils.isempty(children)) {
children = new arraylist();
pnode.setchildren(children);
}
if (children.size() >= 3) {
if(parentcount >= parentnodes.size()){
return createtree( level, nextlevelnodes, childnodes, beginindex);
}
} else {
if (beginindex >= childnodes.size()) {
return true;
}
nodetree child = new nodetree();
child.setlevel(level);
child.setpname(pnode.getname());
nodevo node = childnodes.get(beginindex);
child.setname(node.getnodename());
pnode.getchildren().add(child);
nextlevelnodes.add(child);
beginindex ;
}
parentcount ;
}
}
return true;
}
posted @ 管先飞 阅读(233) | |  

2018年5月20日

执行命名:
git pull github master --allow-unrelated-histories

执行结果如下:

e:\workspace\workspacej2ee\abocode\jfaster>git pull github master --allow-unrelated-histories
remote: counting objects: 3, done.
remote: total 3 (delta 0), reused 0 (delta 0), pack-reused 3
unpacking objects: 100% (3/3), done.
from https://github.com/abocode/jfaster
 * branch            master     -> fetch_head
 * [new branch]      master     -> github/master
merge made by the 'recursive' strategy.
 .gitattributes | 3 
 1 file changed, 3 insertions( )
 create mode 100644 .gitattributes
posted @ 管先飞 阅读(298) | |  

进入“控制面板”——“用户账户”-凭据管理器——windows凭据

找到了git的用户名密码。修改正确后ok

posted @ 管先飞 阅读(238) | |  

2016年8月18日

元注解:

  元注解的作用就是负责注解其他注解。java5.0定义了4个标准的meta-annotation类型,它们被用来提供对其它 annotation类型作说明。java5.0定义的元注解:
    1.@target,
    2.@retention,
    3.@documented,
    4.@inherited

  这些类型和它们所支持的类在java.lang.annotation包中可以找到。下面我们看一下每个元注解的作用和相应分参数的使用说明。
以下为一个简单场景的应用:
 1.定义注解:
   
@target(type)
@retention(runtime)
public @interface table {
/**
* (optional) the name of the table.
*


* defaults to the entity name.
*/
string name() default "";
}

@target({method, field})
@retention(runtime)
public @interface column {

/**
* (optional) the name of the column. defaults to
* the property or field name.
*/
string name() default "";
}
2、定义实体类:
  

@table(name = "t_s_user")
public class user {
@column(name="name")
private string name;

@column(name="pwd")
private string pwd;

public string getname() {
return name;
}

public void setname(string name) {
this.name = name;
}

public string getpwd() {
return pwd;
}

public void setpwd(string pwd) {
this.pwd = pwd;
}
}

3、运行:

public static void print() {
system.out.println("table's name" user.class.getannotation(table.class).name());
field[] fields = user.class.getdeclaredfields();
for (int i = 0; i < fields.length; i ) {
field field = fields[i];
system.out.println("field's type:" field.gettype().getname());
system.out.println("field's columnname:" field.getannotation(column.class).name());
}
}

关于注解的详细介绍:http://www.cnblogs.com/peida/archive/2013/04/24/3036689.html
posted @ 管先飞 阅读(2812) | |  

2016年4月29日

1.选择:file->project structure->libraries

2.左上角选择添加,选择添加java(还提供了添加maven项目),然后选择所需要的目录:

3.idea 会提示选择添加什么类型的文件,我们是单纯的文件,所以选择classes

   

 
posted @ 管先飞 阅读(1677) | |  

2016年1月19日

nginx 反向代理到 apache
server {
        listen       80;
        server_name  app.haeee.com;
index index.html index.htm index.php;
   root /alidata/www/movie-app;
     error_page 404 500 502 503 504 http://app.haeee.com; 
location ~ .*\.(php|php5)?$
{
#fastcgi_pass  unix:/tmp/php-cgi.sock;
fastcgi_pass  127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
#伪静态规则
#include /alidata/server/nginx/conf/rewrite/phpwind.conf;
access_log  /alidata/log/nginx/access/movie-app.log;
}

nginx 反向代理到 tomcat
server {
    listen   80;
    server_name  hulasou.com www.hulasou.com;
index index.html index.htm index.jsp;
#location ~ .*\.(jsp)?$
location /{      
index index.jsp;
        proxy_pass http://localhost:8181;
}
#伪静态规则
include /alidata/server/nginx/conf/rewrite/uuxiaohua.conf;
access_log  /alidata/log/nginx/access/uuxiaohua.log;
}
posted @ 管先飞 阅读(381) | |  

2016年1月14日

1、修改启动项:
@springbootapplication
@componentscan
@import({dbconfiguration.class, resourceconfiguration.class,appconfiguration.class})
public class application extends springbootservletinitializer {
@override
protected springapplicationbuilder configure(springapplicationbuilder application) {
return application.sources(application.class);
}
2、修改pom文件:
    修改packaging
    war
  加入打包到tomcat的配置:

org.springframework.boot
spring-boot-starter-tomcat
provided


org.springframework.boot
spring-boot-legacy
1.0.2.release



javax.servlet
javax.servlet-api
3.0.1


javax.servlet
javax.servlet-api
3.0.1



commons-fileupload
commons-fileupload
1.3.1

3、如果不需要jmx在application.properties文件中加入配置项:
endpoints.jmx.uniquenames=true
或者直接关闭:
 endpoints.jmx.enabled=false
posted @ 管先飞 阅读(6537) | |  

2015年12月28日

spring data 系列一直是开发者追捧的热潮,而官方并未出spring data  jdbc,国外一个开发者让我们看到了福音,文档如下供大家共同学习。

the purpose of this project is to provide generic, lightweight and easy to use dao implementation for relational databases based on from , compatible with spring data umbrella of projects.

design objectives

  • lightweight, fast and low-overhead. only a handful of classes, no xml, annotations, reflection
  • this is not full-blown orm. no relationship handling, lazy loading, dirty checking, caching
  • crud implemented in seconds
  • for small applications where jpa is an overkill
  • use when simplicity is needed or when future migration e.g. to jpa is considered
  • minimalistic support for database dialect differences (e.g. transparent paging of results)

features

each dao provides built-in support for:

  • mapping to/from domain objects through abstraction
  • generated and user-defined primary keys
  • extracting generated key
  • compound (multi-column) primary keys
  • immutable domain objects
  • paging (requesting subset of results)
  • sorting over several columns (database agnostic)
  • optional support for many-to-one relationships
  • supported databases (continuously tested):
    • mysql
    • postgresql
    • h2
    • hsqldb
    • derby
    • ms sql server (2008, 2012)
    • oracle 10g / 11g (9i should work too)
    • ...and most likely many others
  • easily extendable to other database dialects via class.
  • easy retrieval of records by id

api

compatible with spring data abstraction, all these methods are implemented for you:

public interface pagingandsortingrepository extends crudrepository {
 t  save(t entity);
iterable save(iterable entities);
 t  findone(id id);
boolean exists(id id);
iterable findall();
   long count();
   void delete(id id);
   void delete(t entity);
   void delete(iterable entities);
   void deleteall();
iterable findall(sort sort);
page findall(pageable pageable);
iterable findall(iterable ids);
}

pageable and sort parameters are also fully supported, which means you get paging and sorting by arbitrary properties for free. for example say you have userrepository extending pagingandsortingrepository interface (implemented for you by the library) and you request 5th page of users table, 10 per page, after applying some sorting:

page page = userrepository.findall(
new pagerequest(
5, 10, 
new sort(
new order(desc, "reputation"), 
new order(asc, "user_name")
)
)
);

spring data jdbc repository library will translate this call into (postgresql syntax):

select *
from users
order by reputation desc, user_name asc
limit 50 offset 10

...or even (derby syntax):

select * from (
select row_number() over () as row_num, t.*
from (
select * 
from users 
order by reputation desc, user_name asc
) as t
) as a 
where row_num between 51 and 60

no matter which database you use, you'll get page object in return (you still have to provide rowmapper yourself to translate from to domain object). if you don't know spring data project yet, is a wonderful abstraction, not only encapsulating list, but also providing metadata such as total number of records, on which page we currently are, etc.

reasons to use

  • you consider migration to jpa or even some nosql database in the future.

    since your code will rely only on methods defined in and from umbrella project you are free to switch from implementation (from this project) to: , , or . they all implement the same common api. of course don't expect that switching from jdbc to jpa or mongodb will be as simple as switching imported jar dependencies - but at least you minimize the impact by using same dao api.

  • you need a fast, simple jdbc wrapper library. jpa or even is an overkill

  • you want to have full control over generated sql if needed

  • you want to work with objects, but don't need lazy loading, relationship handling, multi-level caching, dirty checking... you need and not much more

  • you want to by

  • you are already using spring or maybe even , but still feel like there is too much manual work

  • you have very few database tables

getting started

for more examples and working code don't forget to examine .

prerequisites

maven coordinates:


com.nurkiewicz.jdbcrepository
jdbcrepository
0.4

this project is available under maven central repository.

alternatively you can .


in order to start your project must have datasource bean present and transaction management enabled. here is a minimal mysql configuration:

@enabletransactionmanagement
@configuration
public class minimalconfig {
@bean
public platformtransactionmanager transactionmanager() {
return new datasourcetransactionmanager(datasource());
}
@bean
public datasource datasource() {
mysqlconnectionpooldatasource ds = new mysqlconnectionpooldatasource();
ds.setuser("user");
ds.setpassword("secret");
ds.setdatabasename("db_name");
return ds;
}
}

entity with auto-generated key

say you have a following database table with auto-generated key (mysql syntax):

create table comments (
id int auto_increment,
user_name varchar(256),
contents varchar(1000),
created_time timestamp not null,
primary key (id)
);

first you need to create domain object mapping to that table (just like in any other orm):

public class comment implements persistable {
private integer id;
private string username;
private string contents;
private date createdtime;
@override
public integer getid() {
return id;
}
@override
public boolean isnew() {
return id == null;
}
//getters/setters/constructors/...
}

apart from standard java boilerplate you should notice implementing where integer is the type of primary key. persistable is an interface coming from spring data project and it's the only requirement we place on your domain object.

finally we are ready to create our dao:

@repository
public class commentrepository extends jdbcrepository {
public commentrepository() {
super(row_mapper, row_unmapper, "comments");
}
public static final rowmapper row_mapper = //see below
private static final rowunmapper row_unmapper = //see below
@override
protected  s postcreate(s entity, number generatedid) {
entity.setid(generatedid.intvalue());
return entity;
}
}

first of all we use annotation to mark dao bean. it enables persistence exception translation. also such annotated beans are discovered by classpath scanning.

as you can see we extend jdbcrepository which is the central class of this library, providing implementations of all pagingandsortingrepository methods. its constructor has three required dependencies: rowmapper, and table name. you may also provide id column name, otherwise default "id" is used.

if you ever used jdbctemplate from spring, you should be familiar with interface. we need to somehow extract columns from resultset into an object. after all we don't want to work with raw jdbc results. it's quite straightforward:

public static final rowmapper row_mapper = new rowmapper() {
@override
public comment maprow(resultset rs, int rownum) throws sqlexception {
return new comment(
rs.getint("id"),
rs.getstring("user_name"),
rs.getstring("contents"),
rs.gettimestamp("created_time")
);
}
};

rowunmapper comes from this library and it's essentially the opposite of rowmapper: takes an object and turns it into a map. this map is later used by the library to construct sql create/update queries:

private static final rowunmapper row_unmapper = new rowunmapper() {
@override
public map mapcolumns(comment comment) {
map mapping = new linkedhashmap();
mapping.put("id", comment.getid());
mapping.put("user_name", comment.getusername());
mapping.put("contents", comment.getcontents());
mapping.put("created_time", new java.sql.timestamp(comment.getcreatedtime().gettime()));
return mapping;
}
};

if you never update your database table (just reading some reference data inserted elsewhere) you may skip rowunmapper parameter or use .

last piece of the puzzle is the postcreate() callback method which is called after an object was inserted. you can use it to retrieve generated primary key and update your domain object (or return new one if your domain objects are immutable). if you don't need it, just don't override postcreate().

check out for a working code based on this example.

by now you might have a feeling that, compared to jpa or hibernate, there is quite a lot of manual work. however various jpa implementations and other orm frameworks are notoriously known for introducing significant overhead and manifesting some learning curve. this tiny library intentionally leaves some responsibilities to the user in order to avoid complex mappings, reflection, annotations... all the implicitness that is not always desired.

this project is not intending to replace mature and stable orm frameworks. instead it tries to fill in a niche between raw jdbc and orm where simplicity and low overhead are key features.

entity with manually assigned key

in this example we'll see how entities with user-defined primary keys are handled. let's start from database model:

create table users (
user_name varchar(255),
date_of_birth timestamp not null,
enabled bit(1) not null,
primary key (user_name)
);

...and domain model:

public class user implements persistable {
private transient boolean persisted;
private string username;
private date dateofbirth;
private boolean enabled;
@override
public string getid() {
return username;
}
@override
public boolean isnew() {
return !persisted;
}
public void setpersisted(boolean persisted) {
this.persisted = persisted;
}
//getters/setters/constructors/...
}

notice that special persisted transient flag was added. contract of [crudrepository.save()]() from spring data project requires that an entity knows whether it was already saved or not (isnew()) method - there are no separate create() and update() methods. implementing isnew() is simple for auto-generated keys (see comment above) but in this case we need an extra transient field. if you hate this workaround and you only insert data and never update, you'll get away with return true all the time from isnew().

and finally our dao, bean:

@repository
public class userrepository extends jdbcrepository {
public userrepository() {
super(row_mapper, row_unmapper, "users", "user_name");
}
public static final rowmapper row_mapper = //...
public static final rowunmapper row_unmapper = //...
@override
protected  s postupdate(s entity) {
entity.setpersisted(true);
return entity;
}
@override
protected  s postcreate(s entity, number generatedid) {
entity.setpersisted(true);
return entity;
}
}

"users" and "user_name" parameters designate table name and primary key column name. i'll leave the details of mapper and unmapper (see ). but please notice postupdate() and postcreate() methods. they ensure that once object was persisted, persisted flag is set so that subsequent calls to save() will update existing entity rather than trying to reinsert it.

check out for a working code based on this example.

compound primary key

we also support compound primary keys (primary keys consisting of several columns). take this table as an example:

create table boarding_pass (
flight_no varchar(8) not null,
seq_no int not null,
passenger varchar(1000),
seat char(3),
primary key (flight_no, seq_no)
);

i would like you to notice the type of primary key in persistable:

public class boardingpass implements persistable {
private transient boolean persisted;
private string flightno;
private int seqno;
private string passenger;
private string seat;
@override
public object[] getid() {
return pk(flightno, seqno);
}
@override
public boolean isnew() {
return !persisted;
}
//getters/setters/constructors/...
}

unfortunately library does not support small, immutable value classes encapsulating all id values in one object (like jpa does with ), so you have to live with object[] array. defining dao class is similar to what we've already seen:

public class boardingpassrepository extends jdbcrepository {
public boardingpassrepository() {
this("boarding_pass");
}
public boardingpassrepository(string tablename) {
super(mapper, unmapper, new tabledescription(tablename, null, "flight_no", "seq_no")
);
}
public static final rowmapper row_mapper = //...
public static final rowunmapper unmapper = //...
}

two things to notice: we extend jdbcrepository and we provide two id column names just as expected: "flight_no", "seq_no". we query such dao by providing both flight_no and seq_no (necessarily in that order) values wrapped by object[]:

boardingpass pass = boardingpassrepository.findone(new object[] {"foo-1022", 42});

no doubts, this is cumbersome in practice, so we provide tiny helper method which you can statically import:

import static com.nurkiewicz.jdbcrepository.jdbcrepository.pk;
//...
boardingpass foundflight = boardingpassrepository.findone(pk("foo-1022", 42));

check out for a working code based on this example.

transactions

this library is completely orthogonal to transaction management. every method of each repository requires running transaction and it's up to you to set it up. typically you would place @transactional on service layer (calling dao beans). i don't recommend .

caching

spring data jdbc repository library is not providing any caching abstraction or support. however adding @cacheable layer on top of your daos or services using is quite straightforward. see also: .

contributions

..are always welcome. don't hesitate to and .

testing

this library is continuously tested using travis (). test suite consists of 60 distinct tests each run against 8 different databases: mysql, postgresql, h2, hsqldb and derby ms sql server and oracle tests not run as part of ci.

when filling or submitting new features please try including supporting test cases. each is automatically tested on a separate branch.

building

after forking the building is as simple as running:

$ mvn install

you'll notice plenty of exceptions during junit test execution. this is normal. some of the tests run against mysql and postgresql available only on travis ci server. when these database servers are unavailable, whole test is simply skipped:

results :
tests run: 484, failures: 0, errors: 0, skipped: 295

exception stack traces come from root .

design

library consists of only a handful of classes, highlighted in the diagram below ():

uml diagram

is the most important class that implements all methods. each user repository has to extend this class. also each such repository must at least implement and (only if you want to modify table data).

sql generation is delegated to . and are provided for databases that don't work with standard generator.

changelog

0.4.1

  • fixed

0.4

  • repackaged: com.blogspot.nurkiewicz -> com.nurkiewicz

0.3.2

  • first version available in maven central repository
  • upgraded spring data commons 1.6.1 -> 1.8.0

0.3.1

  • upgraded spring dependencies: 3.2.1 -> 3.2.4 and 1.5.0 -> 1.6.1
  • fixed

0.3

  • oracle 10g / 11g support (see )
  • upgrading spring dependency to 3.2.1.release and to 1.5.0.release (see ).

0.2

  • ms sql server 2008/2012 support (see )

0.1

  • initial revision ()

license

this project is released under version 2.0 of the (same as ).

posted @ 管先飞 阅读(4058) | |  

2015年9月26日

idea是目前最好的开发工具,经收集及整理如下常用快捷键: 
一、常用快捷键:
 

     
  1.常用操作:
       ctrl e,可以显示最近编辑的文件列表
  shift click可以关闭文件
  ctrl [或]可以跳到大括号的开头结尾
  ctrl shift backspace可以跳转到上次编辑的地方
  ctrl f12,可以显示当前文件的结构
  ctrl f7可以查询当前元素在当前文件中的引用,然后按f3可以选择
  ctrl n,可以快速打开类
  ctrl shift n,可以快速打开文件
  alt q可以看到当前方法的声明
  ctrl w可以选择单词继而语句继而行继而函数
  alt f1可以将正在编辑的元素在各个面板中定位
  ctrl p,可以显示参数信息
  ctrl shift insert可以选择剪贴板内容并插入
  alt insert可以生成构造器/getter/setter等
  ctrl alt v 可以引入变量。例如把括号内的sql赋成一个变量
  ctrl alt t可以把代码包在一块内,例如try/catch
  alt up and alt down可在方法间快速移动

  2. 查询快捷键
  ctrl n 查找类
  ctrl shift n 查找文件
  ctrl shift alt n 查找类中的方法或变量
  cirl b 找变量的来源
  ctrl alt b 找所有的子类
  ctrl shift b 找变量的类
  ctrl g 定位行
  ctrl f 在当前窗口查找文本
  ctrl shift f 在指定窗口查找文本
  ctrl r 在 当前窗口替换文本
  ctrl shift r 在指定窗口替换文本
  alt shift c 查找修改的文件
  ctrl e 最近打开的文件
  f3 向下查找关键字出现位置
  shift f3 向上一个关键字出现位置
  f4 查找变量来源
  ctrl alt f7 选中的字符查找工程出现的地方
  ctrl shift o 弹出显示查找内容

  3. 自动代码
  alt 回车 导入包,自动修正
  ctrl alt l 格式化代码
  ctrl alt i 自动缩进
  ctrl alt o 优化导入的类和包
  alt insert 生成代码(如get,set方法,构造函数等)
  ctrl e 最近更改的代码
  ctrl shift space 自动补全代码
  ctrl 空格 代码提示
  ctrl alt space 类名或接口名提示
  ctrl p 方法参数提示
  ctrl j 自动代码
  ctrl alt t 把选中的代码放在 try{} if{} else{} 里

  4. 复制快捷方式
  ctrl d 复制行
  ctrl x 剪切,删除行
  5. 其他快捷方式
  cirl u 大小写切换
  ctrl z 倒退
  ctrl shift z 向前
  ctrl alt f12 资源管理器打开文件夹
  alt f1 查找文件所在目录位置
  shift alt insert 竖编辑模式
  ctrl / 注释//
  ctrl shift / 注释/*...*/
  ctrl w 选中代码,连续按会有其他效果
  ctrl b 快速打开光标处的类或方法
  alt ←/→ 切换代码视图
  ctrl alt ←/→ 返回上次编辑的位置
  alt ↑/↓ 在方法间快速移动定位
  shift f6 重构-重命名
  ctrl h 显示类结构图
  ctrl q 显示注释文档
  alt 1 快速打开或隐藏工程面板
  ctrl shift up/down 代码向上/下移动。
  ctrl up/down 光标跳转到第一行或最后一行下
  esc 光标返回编辑框
  shift esc 光标返回编辑框,关闭无用的窗口
  f1 帮助千万别按,很卡!
  ctrl f4 非常重要下班都用

二、常用配置:
  1. idea内存优化
  因机器本身的配置而配置:
  \intellij idea 8\bin\idea.exe.vmoptions
  -----------------------------------------
  -xms64m
  -xmx256m
  -xx:maxpermsize=92m
  -ea
  -server
  -dsun.awt.keepworkingsetonminimize=true
posted @ 管先飞 阅读(457) | |  

2015年9月22日

1、编写脚步:update.js
     /**
 * 时间对象的格式化;
 */
date.prototype.format = function(format) {
    /*
     * eg:format="yyyy-mm-dd hh:mm:ss";
     */
    var o = {
        "m " :this.getmonth() 1, // month
        "d " :this.getdate(), // day
        "h " :this.gethours(), // hour
        "m " :this.getminutes(), // minute
        "s " :this.getseconds(), // second
        "q " :math.floor((this.getmonth() 3) / 3), // quarter
        "s" :this.getmilliseconds()
    // millisecond
    }
 
    if (/(y )/.test(format)) {
        format = format.replace(regexp.$1, (this.getfullyear() "")
                .substr(4 - regexp.$1.length));
    }
 
    for ( var k in o) {
        if (new regexp("(" k ")").test(format)) {
            format = format.replace(regexp.$1, regexp.$1.length == 1 ? o[k]
                    : ("00" o[k]).substr(("" o[k]).length));
        }
    }
    return format;
}
var date =new date();
var createdate=date.format("yyyy-mm-dd hh:mm:ss");
date.setminutes(date.getminutes() 5);
var validtime=date.format("yyyy-mm-dd hh:mm:ss");
db.useronlineinfo.update(
{
  "uid" : "110000350"
},
{$set : {
  "uid" : "110000350", 
  "createtime" : createdate,
  "validtime" : validtime
}});
db.useronlineinfo.update(
{
  "uid" : "110000351"
},
{$set : {
  "uid" : "110000351", 
  "createtime" : createdate,
  "validtime" : validtime
}});

2、编写shell脚步:
 #/bin/bash
echo "update mongod begin"
cd /home/mongodb/mongodb-3.0.2/bin
./mongo  192.168.1.122:27108/youliao update.js;
echo "update mongod success"

3、 执行脚本:
/home/mongodb/mongodb-3.0.2/bin/mongo  192.168.1.122:27108/youliao /root/www/job/mongo-test/update.js

备注:
mongodb查询、删除类似

   
posted @ 管先飞 阅读(3544) | |  

网站地图