vladlosev / mongodb-fs Goto Github PK
View Code? Open in Web Editor NEWThis project forked from zhanghaihua/mongodb-fs
fake mongodb server for nodejs
This project forked from zhanghaihua/mongodb-fs
fake mongodb server for nodejs
update
and findandmodify
should reject the empty $set
operator. The message for update
is '$set' is empty. You must specify a field like so: {$mod: {<field>: ...}}
.
When targetting mongodb-fs, the following client is stuck at the call to col.insertMany()
:
const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');
(async function() {
// Connection URL
const url = "mongodb://localhost:27027";
// Database Name
const dbName = 'test';
const client = new MongoClient(url);
try {
// Use connect method to connect to the Server
await client.connect();
console.log('Connected correctly to server');
const db = client.db(dbName);
console.log('Connected correctly to db', dbName);
// Get the collection
const col = db.collection('dates');
console.log('got col');
// Insert multiple documents
const r = await col.insertMany([{ date: new Date() }]);
console.log('inserted many');
// Get first two documents that match the query
const docs = await col.find({}).toArray();
console.log({ docs });
} catch (err) {
console.log(err.stack);
}
client.close();
})();
Any command that adds an element into a collection must create a collection if it doesn't exists. But that should only happen if new element is added. With tests.
The following commands must ensure the collection gets created:
insert
update
with upsert
when inserting a new elementfindAndModify
with upsert
when inserting a new elementcreateIndex
The rest of the commands must not create the collection.
db.collection.update({}, {$pushAll: {fieldName: 'abc'}})
must produce the error message "$pushAll requires an array of values but was given an String", as per MongoDB behavior.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.