<commit_before>var connectionString="mongodb://127.0.0.1:27017/testdb";
var kwaaiCrud=require('./index.js').crudTools(connectionString);

var schema={
    properties:{
        name:{type:"string"},
        description:{type:"string"}
    },
    required:["name"]
}

var validdoc={
    name:"testDistinct",
    description:"testDistinct",
    addVal:"val2"
}

var invaliddoc={
    description:"test1"
}



function operationCompleted(err,value){
    if (err){console.error(err)}
    else{console.log(value)}

    process.exit(1)
}

kwaaiCrud.generateDataPatch({
    collection:{name:"test collection",connectionString:connectionString},
    id:"540af26377e3ed1c0568e4c4",
    data:[
        {op:"add","path":"/anotherThing","value":"a value xxx"}

    ]
},operationCompleted)



/*

 kwaaiCrud.delete({
 collection:{name:"test collection",connectionString:connectionString},
 id:"5400a4160b56b58c1a0e1979",
 useName:true
 },operationCompleted)


 kwaaiCrud.updateFull({
 validate:true,
 collection:{name:"test collection",connectionString:connectionString},
 data:validdoc,
 schema:schema,
 id:"testDistinct",
 useName:true
 },operationCompleted)

console.log("insert check arguments")
kwaaiCrud.insert({
},operationCompleted)

//invalid data
console.log("insert invalid data")
kwaaiCrud.insert({
    validate:true,
    collection:{name:"test collection",connectionString:connectionString},
    schema:schema,
    data:invaliddoc
},operationCompleted)


console.log("check schema if validate true")
kwaaiCrud.insert({
    validate:true,
    collection:{name:"test collection",connectionString:connectionString},
    data:invaliddoc
},operationCompleted)


console.log("insert data no schema")
kwaaiCrud.insert({
    validate:false,
    collection:{name:"test collection",connectionString:connectionString},
    data:validdoc
},operationCompleted)

console.log("insert data")
kwaaiCrud.insert({
    validate:true,
    collection:{name:"test collection",connectionString:connectionString},
    data:validdoc,
    schema:schema
},operationCompleted)


 kwaaiCrud.aggregate({
 collection:{name:"test collection",connectionString:connectionString},
 pipeline:[
 {
 $group : {
 _id : "Count",

 count: { $sum: 1 }
 }
 }
 ]

 },function(err,val){
 console.log(val)

 })


kwaaiCrud.getByQuery({
    collection:{name:"test collection",connectionString:connectionString},
    query:{
        select:"name"
    },
    rawQuery:{
        select:{name:1,description:1}
    }
},function(err,val){
    console.log(val)

})

 kwaaiCrud.countByQuery({
 collection:{name:"test collection",connectionString:connectionString},
 rawQuery:{
 where:{name:"test2"}
 }

 },function(err,val){
 console.log(val)

 })
*/

<commit_msg>Update mongo and crud connection<commit_after>var connectionString="mongodb://127.0.0.1:27017/testdb";
var kwaaiCrud=require('./index.js').crudTools(connectionString);

var schema={
    properties:{
        name:{type:"string"},
        description:{type:"string"}
    },
    required:["name"]
}

var validdoc={
    name:"testDistinct",
    description:"testDistinct",
    addVal:"val2"
}

var invaliddoc={
    description:"test1"
}



function operationCompleted(err,value){
    if (err){console.error(err)}
}

kwaaiCrud.generateDataPatch({
    collection:"test collection",
    id:"540af26377e3ed1c0568e4c4",
    data:[
        {op:"add","path":"/anotherThing","value":"a value dddxxx"}

    ]
},operationCompleted)



kwaaiCrud.getByQuery({
    collection:"test collection",
    query:{
        select:"name"
    },
    rawQuery:{
        select:{name:1,description:1}
    }
},function(err,val){
    if (err){console.error(err)}
    console.log(val)

})

kwaaiCrud.countByQuery({
    collection:"test collection",
    rawQuery:{
        where:{name:"test2"}
    }

},function(err,val){
    if (err){console.error(err)}else{
    console.log(val);}

})

kwaaiCrud.insert({
    validate:true,
    collection:"test collection",
    schema:schema,
    data:invaliddoc
},function(err,val){
    if (err){console.error(err)}else{
        console.log(val);}

})

kwaaiCrud.insert({
    validate:true,
    collection:"test collection",
    schema:schema,
    data:validdoc
},function(err,val){
    if (err){console.error(err)}else{
        console.log(val);}

})

kwaaiCrud.delete({
    collection:"test collection",
    id:"5400a4160b56b58c1a0e1979",
    useName:true
},function(err,val){
    if (err){console.error(err)}else{
        console.log(val);}

})

kwaaiCrud.updateFull({
    validate:true,
    collection:"test collection",
    data:validdoc,
    schema:schema,
    id:"testDistinct",
    useName:true
},function(err,val){
    if (err){console.error(err)}else{
        console.log(val);}

})

/*






console.log("insert check arguments")
kwaaiCrud.insert({
},operationCompleted)

//invalid data
console.log("insert invalid data")



console.log("check schema if validate true")
kwaaiCrud.insert({
    validate:true,
    collection:{name:"test collection",connectionString:connectionString},
    data:invaliddoc
},operationCompleted)


console.log("insert data no schema")
kwaaiCrud.insert({
    validate:false,
    collection:{name:"test collection",connectionString:connectionString},
    data:validdoc
},operationCompleted)

console.log("insert data")
kwaaiCrud.insert({
    validate:true,
    collection:{name:"test collection",connectionString:connectionString},
    data:validdoc,
    schema:schema
},operationCompleted)


 kwaaiCrud.aggregate({
 collection:{name:"test collection",connectionString:connectionString},
 pipeline:[
 {
 $group : {
 _id : "Count",

 count: { $sum: 1 }
 }
 }
 ]

 },function(err,val){
 console.log(val)

 })




*/


{'fraction_non_alphanumeric': 0.15398198834539997, 'fraction_numerical': 0.01818823944905527, 'mean_word_length': 4.613478691774033, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7093165', 'n_tokens_mistral': 1895, 'n_tokens_neox': 1815, 'n_words': 271}