Code Monkey home page Code Monkey logo

mongo-views's Issues

mongo refuses to start up in --nodb mode

$ ./mongo --nodb
MongoDB shell version: 3.1.0-pre-
mongo-views is initiating!
2015-03-11T12:20:29.187-0400 E QUERY ReferenceError: db is not defined
at getCurrentDb (/Users/charlie/github/my-mongo-views/lib/config.js:23:20)
at loadViewsInDB (/Users/charlie/github/my-mongo-views/lib/init.js:94:13)
at Object.init.js (/Users/charlie/github/my-mongo-views/lib/init.js:133:5)
at DBCollection (/Users/charlie/.mongo-views.js:29:34)
at /Users/charlie/.mongo-views.js:31:3
at /Users/charlie/.mongorc.js:2:1 at /Users/charlie/github/my-mongo-views/lib/config.js:23
2015-03-11T12:20:29.187-0400 E QUERY Error: error loading js file: /Users/charlie/.mongo-views.js
at /Users/charlie/.mongorc.js:2:1 at /Users/charlie/.mongorc.js:2
The ".mongorc.js" file located in your home folder could not be executed

createView: empty criteria field should default to {}

> db.employees.insert(
...     [
...         {name: "John", dob: new Date(1980, 1, 2)},
...         {name: "Paul", manager: true, dob: new Date(1983, 7, 10), uid: 3},
...         {name: "Mary", dob: new Date(1985, 5, 12), uid: 20},
...         {name: "Aimee", manager: true, dob: new Date(1945, 2, 20), uid: 50}
...     ]
... )

> db.employees.createView("managers")
WriteResult({ "nInserted" : 1 })

> db._managers.find()
Error: error: {
    "$err" : "Can't canonicalize query: BadValue $or/$and/$nor entries need to be full objects",
    "code" : 17287
}

But this works:

db.employees.createView("managers", {})

Regex is not persisted correctly.

@cswanson310

Steps to repro:

db.createView('managers', { name: /john/})

restart shell

and nothing is returned from the query.

persistence for regex looks like

{
  "_id": ObjectId("54f8a114ad4fc3af583357f2"),
  "name": "managers",
  "target": "employees",
  "query": "{\"name\":{}}",
  "projection": "{}"
}

Persisting regexes does not work.

Including a regex in criteria, such as { name: /john/ }, will not load on startup. The reason is that JSON.stringify is not correctly serializing regular expressions.

Steps to reproduce:

  • create a view with an inline regex in the criteria
  • query the view, works as expected
  • restart mongo
  • query the view, note how the regex criteria is not hit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.